Model.getSelectionModel().selectRow(0) not work ...
this.store = new Ext.data.Store({
...
listeners: {
load: function() {
this.grid.getSelectionModel().selectFirstRow();
},
scope: this
}
});
this.grid = new Ext.grid.GridPanel({
...
store: this.store
});
Something like this should work, assuming this.store and this.grid exist, I'm sure you can adapt it.
I am just reiterating Lioyd's answer.
Also make sure that you have configured RowSelection Model in grid.
var grid = new Ext.grid.GridPanel({
store: ....,
sm: new Ext.grid.RowSelectionModel({singleSelect: true}),
// other grid configurations goes here
listeners: {
render : function(grid){
grid.store.on('load', function(store, records, options){
grid.getSelectionModel().selectFirstRow();
});
}
}
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With