Hybrid View

  1. #1
    Sencha User
    Join Date
    May 2010
    Posts
    172
    Vote Rating
    1
    Dmoney is on a distinguished road

      0  

    Default record.set not updating grid.

    record.set not updating grid.


    I have a form bound to a grid when I click on a record the data is displayed in the form. and the record can be edited. when I submit an edit I use the following in my controller:

    Code:
        form = Ext.getCmp('contentForm').getForm();
            record = form.getRecord(),
            values = form.getValues();
     if(values.contentID){
        record.set(values);
        Ext.getCmp('contentList').store.sync();
        //Ext.getCmp('contentList').store.commitChanges();
        } else{
         Ext.getCmp('contentList').store.add(values);
         Ext.getCmp('contentList').store.sync();
         Ext.getCmp('contentList').store.load();
        }
    on an edit I shouldn't have to load the store again but record.set is not updating the record in the grid. If I load the store again I can see the changes, if I click on the record I can see the the data displayed in the form is the new edited data. But the record in the grid continues to display the data as it was before the edit. unless I load the store again.

    I'm expecting record.set() to update the record in the grid. It should also show the record as dirty until I call store.commitChanges(); But that's not what I'm seeing.

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


    Is the store's datachanged event firing? The grid should be listening to the datachanged event on the store to change it's rows.
    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
    Mar 2011
    Posts
    208
    Vote Rating
    0
    bee is on a distinguished road

      0  

    Default


    Can you please elaborate more ?

  4. #4
    Sencha User
    Join Date
    May 2010
    Posts
    172
    Vote Rating
    1
    Dmoney is on a distinguished road

      0  

    Default


    Sorry this is part of a large project and I havent had time to isolate the problem and create an example. In my large application though the datachanged event does not appear to fire.

  5. #5
    Sencha User
    Join Date
    Jan 2012
    Posts
    4
    Vote Rating
    0
    robertb216 is on a distinguished road

      0  

    Default


    Dmoney's description is accurate, the record.set(values) command is not refreshing the grid although the store is correctly updated. If the user selects the row again from the grid or sorts from the column header, the modified field is marked as dirty. This code was working correctly in 4.0.7 but when I upgraded to 4.1 beta2, the problem appeared. I'm guessing the store's datachanged event isn't firing... any suggestions on a quick fix ???

    Controller:

    Ext.define('AM.controller.Users', {
    extend: 'Ext.app.Controller',


    views: [ 'user.List',
    'user.Edit'
    ],


    stores: [ 'Users' ],
    models: [ 'User' ],


    init: function() {
    this.control({
    'userlist': {
    itemdblclick: this.editUser
    },
    'useredit button[action=save]': {
    click: this.updateUser
    }
    });
    },


    editUser: function(grid, record) {
    var view = Ext.widget('useredit');
    view.down('form').loadRecord(record);
    },
    updateUser: function(button) {
    var win = button.up('window'),
    form = win.down('form'),
    record = form.getRecord(),
    values = form.getValues();
    record.set(values);
    win.close();
    this.getUsersStore().sync();


    }


    });

  6. #6
    Ext JS Premium Member burnnat's Avatar
    Join Date
    Jun 2011
    Posts
    418
    Vote Rating
    61
    burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough

      0  

    Default


    Just a thought... perhaps this is related to EXTJSIV-5136?