remember after refresh selected row in extjs grid

后端 未结 5 1567
借酒劲吻你
借酒劲吻你 2020-12-17 14:56

I have a problem. I use extjs grid. This grid will be refreshed every seconds.

I refresh with this function:

ND.refresh =          


        
5条回答
  •  伪装坚强ぢ
    2020-12-17 15:22

    The straightforward solution is just save somewhere in js index of selected row. Then after reload you could easily select this row by index using grid's selection model.

    Get selection model: http://docs.sencha.com/ext-js/4-0/#!/api/Ext.grid.Panel-method-getSelectionModel

    var selectionModel = grid.getSelectionModel()
    

    Get selected rows: http://docs.sencha.com/ext-js/4-0/#!/api/Ext.selection.Model-method-getSelection

    var selection = selectionModel.getSelection()
    

    Set selected row back: http://docs.sencha.com/ext-js/4-0/#!/api/Ext.selection.Model-method-select

    selectionModel.select(selection)
    

提交回复
热议问题