1. #1
    Ext JS Premium Member
    Join Date
    Oct 2011
    Posts
    54
    Vote Rating
    0
    pm100 is on a distinguished road

      0  

    Default change to ext.data.model behavior

    change to ext.data.model behavior


    IN the old version I could call set on a field that did not exist (ie not declared in the fields array) and all was well, everything worked. In 4.1 that doesnt work. MY problem is that I dont know the fields I am going to get until very late - i get data from my server and it has fields in it; i just load them into the model object and off we go. I will admit that for some (not all) fields i did ext.apply(item.data, serverObject); which is not strictly speaking following the published interface but worked very nicely. Certainly there is no way that I can statically define a separate model item for my objects, I do not know in advance what they will be. Today I have just one 'abstract' class that has a well known set of control fields on it

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


    There were reports that people didn't like the fields being changed. If the current behavior doesn't sit well for you then you can change the data object yourself and set the dirty flag. The only problem is if you require the use of the model/store keeping record of the modifications.
    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
    Ext JS Premium Member
    Join Date
    Oct 2011
    Posts
    54
    Vote Rating
    0
    pm100 is on a distinguished road

      0  

    Default


    not sure i understand

    >>There were reports that people didn't like the fields being changed.
    dont know what that means
    >>If the current behavior doesn't sit well for you then you can change the data object yourself and set the dirty flag.
    By 'current' do you mean 4.0.7 or 4.1?
    If you mean that I should change my 4.1 test code to call setDirty after I merge my data into the model object - this doesn't work. The getData function (called by gird and tree) only returns data from defined fields

  4. #4
    Ext JS Premium Member
    Join Date
    Oct 2011
    Posts
    54
    Vote Rating
    0
    pm100 is on a distinguished road

      0  

    Default


    simple work round for me was to override the getData method

    getData:function()
    {
    return me.data;
    }

    not subtle - but effective

Thread Participants: 1