PDA

View Full Version : selectRow by Id, not by index



mysticav
22 Mar 2007, 8:39 PM
How can I select a grid row by its ID ?

The ID defined with Ext.data.JsonReader :



var reader = new Ext.data.JsonReader({
root: 'myRoot',
totalProperty: 'totalCount',
id: 'id'
}, Record);


Instead of:
grid.getSelectionModel().selectRow(index);

I'm looking for something like:
grid.getSelectionModel().selectRowById(id);

(The id is the actual primary key record from database table).

Animal
23 Mar 2007, 1:02 AM
Use Store.indexOfId()

mysticav
23 Mar 2007, 10:45 AM
Works. Thanks.

aohza
30 Mar 2008, 12:04 PM
don 't work in IE7 it return -1
FireFox it work