ExtJs Gridpanel store refresh

后端 未结 10 1221
刺人心
刺人心 2020-12-28 14:08

I am binding ExtJs Gridpanel from database and add \"Delete\" button below my gridpanel. By using the delete button handler, I have deleted selected record on gridpanel. But

相关标签:
10条回答
  • 2020-12-28 14:14

    try this grid.getView().refresh();

    0 讨论(0)
  • 2020-12-28 14:14

    Another approach in 3.4 (don't know if this is proper Ext): You can have a delete handler like this, assuming every row has a 'delete' button.

    handler: function(grid, rowIndex, colIndex) {
        var rec = grid.getStore().getAt(rowIndex);
        var id = rec.get('id');
        // some DELETE/GET ajax callback here...
        // pass in 'id' var or some key
        // inside success
        grid.getStore().removeAt(rowIndex);
    }
    
    0 讨论(0)
  • 2020-12-28 14:17

    Try refreshing the view:

    Ext.getCmp('yourGridId').getView().refresh();
    
    0 讨论(0)
  • 2020-12-28 14:20

    reload the ds to refresh grid.

    ds.reload();
    
    0 讨论(0)
  • 2020-12-28 14:22
    grid.getStore().reload({
      callback: function(){
        grid.getView().refresh();
      }
    });
    
    0 讨论(0)
  • 2020-12-28 14:26

    I had a similiar problem. All I needed to do was type store.load(); in the delete handler. There was no need to subsequently type grid.getView().refresh();.

    Instead of all this you can also type store.remove(record) in the delete handler; - this ensures that the deleted record no longer shows on the grid.

    0 讨论(0)
提交回复
热议问题