• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: binding selection in tableview to model
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: binding selection in tableview to model


  • Subject: Re: binding selection in tableview to model
  • From: mmalcolm crawford <email@hidden>
  • Date: Wed, 18 Feb 2004 00:56:10 -0800

On Feb 17, 2004, at 7:06 PM, Alan Donsky wrote:

Is there a way to bind the selection of a table view to a model? I know this can be done with a popup menu using the selectedObject binding, but i want an instance variable in my model (i.e. selectedGroup) to be set to the object represented by the tableview.
I hope this makes sense.
I think the problem lies in the fact that tablevirews represent to-many relationships while popup buttons represent to-one relationships, but i am not sure.
I have tried creating a new object controller which i can bind to the selectedObject instance variable but i am not sure how to bind it to the array controller for the tableview.

I don't *think* (correction welcome) there's an easy way to do this with bindings in a single table view. For the sort of to-many relationship I believe you're describing(?) you have to present the full list from which the user can choose, and then allow them to make a selection. In a single table view you can do this with checkboxes to indicate selection, but since checkbox state will refer to and modify a second array I don't think you can set this up with bindings.

The alternative is to display two table views, one with the complete set, the other with the selection. Two buttons will allow you to (a) add objects selected in the complete set to the selection; and (b) remove objects selected in the selection from the selection. This is reasonably easy to set up; slightly tricker is a refinement where the "complete set" actually only displays those object not in the selection...

mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: binding selection in tableview to model
      • From: mmalcolm crawford <email@hidden>
References: 
 >binding selection in tableview to model (From: Alan Donsky <email@hidden>)

  • Prev by Date: Re: Variable height outline view
  • Next by Date: Re: Drawing shadows under views
  • Previous by thread: binding selection in tableview to model
  • Next by thread: Re: binding selection in tableview to model
  • Index(es):
    • Date
    • Thread