1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    21
    Answers
    2
    Vote Rating
    0
    Greezer is on a distinguished road

      0  

    Default Unanswered: Filtering offline Store

    Unanswered: Filtering offline Store


    I think it should works, but when the app is offline I want to filter my localstorage Store and it's not working.

    Here's my code :

    Code:
    if(navigator.onLine) {
                objectStoreLocal.removeAll();
    
    
                objectStore.load({
                    params: {
                        session: SwissParlWebApp.app.session
                    }
                });
    
    
                objectStore.on('load', function() {                                 
    
    
                    for (i=0; i<objectStore.data.all.length; i++) {                    
                        object = new Ext.create('SwissParlWebApp.model.Objet');
                        object.set('ID', objectStore.data.all[i].data.ID);
                        object.set('description_objet', objectStore.data.all[i].data.description_objet);                            
                        
                        objectStoreLocal.add(object);
                    }
                    objectStoreLocal.sync();    
                    objectStoreLocal.filter(
                        new Ext.util.Filter({
                            filterFn: function(record) {                        
                                return (record.data.ID.substring(2,3) === '.')
                                }
                            })
                    );               
                 });     
            } else {
                Ext.getCmp('objectList').getStore().clearFilter();
                Ext.getCmp('objectList').getStore().filter(
                    new Ext.util.Filter({
                        filterFn: function(record) {        
                            return (record.data.ID.substring(2,3) === '.')
                        }
                    })
                );               
            }            
    but it's not working, when I debug the LocalStorage Store doesn't have any filter....

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,620
    Answers
    3451
    Vote Rating
    817
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Does that filter means work for your online store?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    May 2012
    Posts
    21
    Answers
    2
    Vote Rating
    0
    Greezer is on a distinguished road

      0  

    Default


    Actually, the Store linked to my list is the offline Store yes, so I guess the filter should be applied. The "proxy" store is only here for catching datas from server.

    I'm still working on this.

  4. #4
    Sencha User
    Join Date
    May 2012
    Posts
    21
    Answers
    2
    Vote Rating
    0
    Greezer is on a distinguished road

      0  

    Default


    The problem is that it's seems to be impossible to applied some filter when the app is offline...

Thread Participants: 1

Tags for this Thread