Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-2724 in a recent build.
  1. #1
    Sencha Premium Member
    Join Date
    Oct 2011
    Location
    Duluth, MN
    Posts
    126
    Vote Rating
    4
    badgerb1 is on a distinguished road

      0  

    Default Model Field: persist:false does not work

    Model Field: persist:false does not work


    Hi guys,

    If I set a field to persist:false it still gets persisted to the localstorage.

    Thanks
    Bob

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,824
    Vote Rating
    836
    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


    Thanks for the report. I have made a test case for you:

    Code:
    new Ext.data.Store({
        fields : [
            { name : 'text' },
            { name : 'foo', persist : false }
        ],
    
        data : [
            {
                text : 'Test',
                foo  : 'bar'
            }
        ],
    
        proxy : {
            type : 'localstorage',
            id   : 'test'
        }
    }).sync();
    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
    Feb 2012
    Location
    Austria
    Posts
    2
    Vote Rating
    0
    martinvidec is on a distinguished road

      0  

    Default Don't know if that bug has been fixed yet... in case it hasn't:

    Don't know if that bug has been fixed yet... in case it hasn't:


    this works for me in sencha touch 2.0.0:

    Code:
    Ext.define('My.override.of.ext.data.proxy.WebStorage', {
        override: 'Ext.data.proxy.WebStorage',
        
        setRecord: function(record, id){
            if (id) {
                record.setId(id);
            } else {
                id = record.getId();
            }
    
    
            var me = this,
                rawData = record.getData(),
                data    = {},
                Model   = me.getModel(),
                fields  = Model.getFields().items,
                length  = fields.length,
                i = 0,
                field, name, obj, key, dateFormat;
    
    
            for (; i < length; i++) {
                field = fields[i];
                name  = field.getName();
                
                if(field.getPersist() === false){
                    continue;
                }
                
                if (typeof field.getEncode() == 'function') {
                    data[name] = field.getEncode()(rawData[name], record);
                } else {
                    if (field.getType().type == 'date' && Ext.isDate(rawData[name])) {
                        dateFormat = field.getDateFormat();
                        if (dateFormat) {
                            data[name] = Ext.Date.format(rawData[name], dateFormat);
                        } else {
                            data[name] = rawData[name].getTime();
                        }
                    } else {
                        data[name] = rawData[name];
                    }
                }
            }
    
    
            obj = me.getStorageObject();
            key = me.getRecordKey(id);
    
    
            //keep the cache up to date
            me.cache[id] = record;
    
    
            //iPad bug requires that we remove the item before setting it
            obj.removeItem(key);
            obj.setItem(key, Ext.encode(data));
        }
    });
    Martin Videc,

    levatis GmbH (Austria) Software Developer
    For more information about me visit www.videc.at

  4. #4
    Sencha User farion's Avatar
    Join Date
    Feb 2008
    Location
    Karlsruhe, Germany
    Posts
    75
    Vote Rating
    11
    farion will become famous soon enough

      0  

    Default


    Currently the id is also saved to the value. ExtJS does not save the id.

    What behavior is the correct one?

  5. #5
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    10
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    This has been fixed for the next release. Thanks for the report and the fix!