PDA

View Full Version : How to get the ROW from gridpanel?



Roomy
29 May 2013, 2:06 AM
Below line is not working to select row from gridPanel.

var rowToHighlight=Ext.get(grid.view.getRow(rowIndex));

Farish
29 May 2013, 2:43 AM
what exactly do you want to do? The selection model might help you:

http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.selection.Model

E.g. if you want to get the selected row(s):


var sRows = grid.getSelectionModel().getSelection();

or if you want to set the selection programmatically:

var index = 0;
grid.getSelectionModel().select(index); // select record by index

var record = grid.getStore().first();
grid.getSelectionModel().select(record); // select record

Roomy
29 May 2013, 2:54 AM
I use both the code line but result is UnDefined. :s

Farish
29 May 2013, 3:00 AM
what is undefined? do you have the grid visible in this scope? if you are using an id in your grid, then you can try Ext.getCmp('gridID').getSelectionModel()....