Reputation: 10624
I want to select a specific row after reload my grid. and the specific row will be different in every process. So after reload grid, I want to select the row at the once. It does not effect to select the row later.
I tried like this,
//i is row index No. and i value is vary.
this.getMyGrid().fireEvent('itemclick',this.getMyGrid().getView(),this.getMyGrid().store.getAt(i)); // this reload grid
this.getMyGrid().getSelectionModel().select(i);// select row
but the code problem is select row before complete load grid.
How can I run the select code after grid load complete?
Thank you.
Upvotes: 1
Views: 2392
Reputation: 11486
The grid's selection model has a method getLastSelected, you can can use something like this in the grid store's load
event handler:
var myGrid = this.getMyGrid(),
selModel = myGrid.getSelectionModel();
selModel.select(selModel.getLastSelected());
Upvotes: 1