PDA

View Full Version : selectFirstRow after load()



Stephan123
16 Dec 2009, 1:35 AM
Hello !

I have a grid.
I will load this grid and than i will select the first row in this grid.


// Tabelle neu laden
Ext.getCmp('myGrid').store.load();

// markieren der ersten Zeile
Ext.getCmp('myGrid').getSelectionModel().selectFirstRow();

I see for a little moment the first row is selected.
In the next moment the row is unselected.

How can i solve this problem ?

Your sincerly

Stephan

stephen.friedrich
16 Dec 2009, 2:21 AM
Try to select the row after the store finished loading:


Ext.getCmp('myGrid').store.load({
callback: function() {
Ext.getCmp('myGrid').getSelectionModel().selectFirstRow();
}
});
I am not really sure why this is necessary.
Usually the selection survives a reload (as long as the row's id does not change).
Maybe somebody else can shed some light on this?