How to select a row in the grid AFTER loading the network?

Model.getSelectionModel (). selectRow (0) does not work ...

+6
extjs
source share
2 answers
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.

+20
source share

I'm just repeating Lloyd's answer.

Also make sure that you configure the RowSelection model in the 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(); }); } } }) 
+2
source share

All Articles