开发者

How to select row in grid AFTER load grid? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 开发者_运维问答10 years ago.

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();       
                  });                      
                }
               }
            })      
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜