0

I have an Store and a LocalStorage Proxy. The Store is connected to gridpanel. In the toolbar of the gridpanel is a button "remove all". This button is connected to an controller action as follows:

var store = Ext.getStore("Conflicts");

    console.log(store);
    store.load({
        callback: function(){
            console.log(store);
                store.removeAll();
                store.sync();
            console.log(store);
        }
    });

    console.log(store);

As you can see I added some console.log() to see what's in the Store. My Problem is that from the beginning (first console.log()) there is no data in the Store. But anyways, in my Grid I see about 170 items, which are in the Store and after clicking removve Button they disappear from the grid, but if I refresh the page they are there again. I have also autoload and autosync property set to true. The output of console.log() stays the same all time. I tried with and without store.load() but there is always no data in the store I am going to empty.

Thanks for any help.

4

1 回答 1

0

众所周知, store.removeAll() 实际上不会删除记录,而只是清除存储。小心,这种行为随着更高版本而改变

您可以改用:

var store = Ext.getStore("Conflicts");

console.log(store);
store.load({
    callback: function(){
        console.log(store);
        store.remove(store.getRange());
        store.sync();
        console.log(store);
    }
});

console.log(store);
于 2013-08-01T13:02:59.933 回答