PDA

View Full Version : Position to row in grid



mjhaston
10 Feb 2011, 7:43 AM
Based off of this example: http://dev.sencha.com/deploy/dev/examples/form/form-grid.html

I have a grid that loads all records at once. The user can type a name into a combobox, make a selection from the box and the grid is then filtered down to that one name they selected. I also use this bit of code to select the first record so that the detail is displayed ...



ds.on('load', function(){
grid.getSelectionModel().selectFirstRow();
});



Now they have asked if I can still keep the fully loaded grid, but position to the row containing the name they've selected from the combobox.

Is this possible? Would I need to find the "id" of the row as I load the grid?

mjhaston
10 Feb 2011, 7:54 AM
Okay, searched a little more and found I can do this ...



grid.getSelectionModel().selectRow(n);


I'll just have to figure out how to get the "id" of the selected name. I also need to figure out if I can auto-scroll the grid to that selected row.