Sharon Watinsan
Sharon Watinsan

Reputation: 9850

Reload a Store and populate Grid without redrawing Window

I have a grid, and when i click on a row, and click the remove button. that record will get removed from the server and the grid will get updated. (If there are 10 records and if we delete 1, then there will be 9 records.)

This works for the 1st time, when we try to remove an item from the grid. Once the record gets removed and the grid gets updated. The Window that contains the grid gets drawn below the screen. I need to get rid of this.

How do i reload a store without redrawing the Window.

My code;

var ras = Ext.getStore('RemoveARowStore');

ras.on('load', function() {
       var grid = Ext.ComponentQuery.query('#window1 > #form1 > #grid1')[0];
    grid.getStore.load();
       grid.getView().refresh();

}, this, { single: true });
ras.load();

Upvotes: 0

Views: 758

Answers (1)

Alex
Alex

Reputation: 5724

If you update a store, the grid should automagically update the grid.

Therefore, you shouldnt have to do do grid.getView.refresh() which will be your offending line.

Furthermore, in the current snippet, actually watching for the load event, and actioning on it is kind of pointless. ( The grid will update itself anyway )

Upvotes: 2

Related Questions