1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    43
    Vote Rating
    0
    durgaprasadn is on a distinguished road

      0  

    Default store.sync just sends the modified prop along with id, not complete object on update

    store.sync just sends the modified prop along with id, not complete object on update


    Hello Team,
    I am doing the update at the grid and calling the store.sync() in the edit listener as follows and I am seeing in the firebug the json object with id and modified properties.

    {"vanityUrls":[{"linkUrl":"vanity3testing","linkId":29926}]}.

    Service is expecting the complete object as defined in the model as grid client has all those values. But when I do store.sync(), it is just sending the modified properties.


    service expecting all the values for that record along with modified values as follows:{"vanityUrls":[{"linkId":29927,"linkType":0,"linkUrl":"vanity4testing","divisionId":0,"businessUnitId":1,"updatedOn":1334697924830,"locale":"EN_US"}]}

    My model object
    Ext.define('VanityUrl', {
    extend: 'Ext.data.Model',
    idProperty:'linkId',
    fields: [
    {name:'linkId', type: 'int'},
    { name:'linkType', type: 'int'},
    { name: 'linkUrl', type: 'string'},
    { name: 'vanityUrl', type: 'string'},
    { name: 'divisionId', type: 'int'},
    { name: 'description', type: 'string'},
    { name: 'comments', type: 'string'},
    {name: 'createdOn', type: 'date', dateFormat: 'Y-m-d'},
    {name: 'createdBy', type: 'string'},
    {name: 'updatedOn', type: 'date', dateFormat: 'Y-m-d'},
    {name: 'updatedBy', type: 'string'},
    {name: 'sourceCode', type: 'string'},
    {name: 'businessUnitId', type: 'int'},
    {name: 'locale', type: 'string'}
    ]
    });

    listener where i am calling the store.sync()

    listeners: {
    'edit': function (e, eOpts) {
    alert('edit row editing');
    alert(e.record.data.vanityUrl);
    store.sync();

    // e.record.commit();
    },
    'selectionchange': function(view, records) {
    grid.down('#removeVanityUrl').setDisabled(!records.length);
    },
    'beforeedit': function (e, eOpts) {
    var linkType = e.record.data.linkType;
    if(linkType != 8)
    {
    return false;
    }
    }
    }

    --Durga

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,154
    Vote Rating
    475
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    What version of ExtJS4 are you using? try manually setting writeAllFields: true and see if that helps

    Scott.

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    43
    Vote Rating
    0
    durgaprasadn is on a distinguished road

      0  

    Default


    Thank you very much for your response. I am using extjs4 and writeFields:true helped me in solving the problem.

Thread Participants: 1