PDA

View Full Version : SelectionModels



Jan Pogadl
2 May 2012, 10:41 PM
Hi,

i got some questions about SelectionModels

1. Can i share a RowSelection Model between a Grid and a View?

2. Is there a way to bind the selection model after the Grid/View is allready instanciated?

3. How to unbind a view from the SelectionModel (RowSelectionModel)?

Thanks

mitchellsimoens
7 May 2012, 6:44 AM
You shouldn't share a selection model unless you want odd behaviors. Like if you select something in one view it may update the other or the last one with the selection model may win and the other won't work.

I would have the selection model setup at instantiation. You could probably get it to work by updating the grid panel and grid view and refreshing the selection model, haven't tried it myself.

Not sure why you would want to remove a selection model. It would be the inverse of the 2nd item.

mitchellsimoens
7 May 2012, 6:45 AM
Just noticed the undocumented bindComponent method on the row model.

Jan Pogadl
8 May 2012, 8:33 AM
Thanks for your answer.

What i ended up doing is defining my own SelectionModel to which one can bind and unbind other SelectionModels to.

Now in my MVC application the Controller can easily change the current selection and keep track of it even no view exists at all. It is also easily possible to atach and detach Grids and Dataviews to it on creation/destroy.