-
15 Mar 2012 8:41 AM #1
Getting a handle to a grid from a selected row
Getting a handle to a grid from a selected row
How do you get a handle to the grid from a selected row event? I can't seem to find a way to do this via the event objects (RowModel and Model). Is there anyway to swim upstream from this event to get a handle to the grid (I don't want to query by id or type).
-
15 Mar 2012 9:05 AM #2
you can get the grid's selected item like this:
where gridPanel is the component reference.Code:var record = gridPanel.getSelectionModel().getSelection()[0];
-
15 Mar 2012 9:07 AM #3
What do you mean by get a handle? If you are looking to get the information of the selected row in a grid, you can use this
Code:gridRecord = grid.getSelectionModel().getSelection(); // Select the selected rows record = gridStore.getStore().getAt(gridRecord[0].index) // Select the information in the store of the first selected row
-
15 Mar 2012 9:09 AM #4
Oh you meant from the event to the grid.
You should be able to use the 'up' function from the event's component. Something like:
Code:button.up('gridpanel');
-
15 Mar 2012 9:57 AM #5
Thanks - I was able to get a reference to the grid via:
rowModel.view.up(...).


Reply With Quote