Results 1 to 4 of 4

Thread: Store removeAll() doesn't work for localstorage

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-8149 in 4.2.0.489.
  1. #1
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    82

    Default Store removeAll() doesn't work for localstorage

    Using local storage and attempting to remove all previous records note that previous records are still available next time. Using the following code and refreshing the browser over and over yields 2 additional fields on each reload.
    Code:
            Ext.define('Search', {
                fields:['id', 'query'],
                extend:'Ext.data.Model'
            });
    
    
    
    
            //our Store automatically picks up the LocalStorageProxy defined on the Search model
            var store = Ext.create('Ext.data.Store', {
                model:"Search",
                proxy:{
                    type:'localstorage',
                    id:'twitter-Searches'
                }
            });
    
    
    
    
    //loads any existing Search data from localStorage
            store.load();
    
    
            store.removeAll();
    
    
    //now add some Searches
            store.add({query:'Sencha Touch'});
            store.add({query:'Ext JS'});
    
    
    //finally, save our Search data to localStorage
            store.sync();
    
    
    //        //dynamic load the store now
            store.load({
                scope:this,
                callback:function (managers, operation, success) {
    
    
                    Ext.each(managers, function (manager) {
    
    
                        var name = manager.data.query;
                        console.log('manager is '+name);
                    } );
                    }}
            );
        }
    From the console you will see that each time you run it you get back 2 more results despite the fact that removeAll() is called prior to adding the new record.

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,449

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

  3. #3
    Ext JS Premium Member
    Join Date
    Jan 2011
    Posts
    8

    Default

    where can I find the fix , please ????


    Pedro Miguel Martins

  4. #4
    Sencha Premium User wemerson.januario's Avatar
    Join Date
    Nov 2008
    Location
    Goiânia - GO, Brazil
    Posts
    898

    Default

    I have this problem with Ext JS 6
    Wemerson Januario @JanuarioCoder
    Novanti Tecnologia, Sencha MVP/ Ext JS Consultant
    ____________________________________________
    Hire me on UpWork:

    GitHub
    https://github.com/wemersonjanuario

    Treinamento e Consultoria Ext JS. QUALIFIQUE-SE JÁ!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •