You found a bug! We've classified it as TOUCH-3888 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    1
    Vote Rating
    0
    lgreenway is on a distinguished road

      0  

    Default DataView Error When Updating Store Data on Controller Launch

    DataView Error When Updating Store Data on Controller Launch


    Sencha Touch version tested:
    • Sencha Touch 2.1
    Browser versions tested against:
    • Google Chrome 23.0.1271.97 m
    • Playbook 2.0 Webkit
    DOCTYPE tested against:
    • html
    Description:
    • In a Controller's launch function, when attempting to update a model object instance contained in a store specified in a DataView's config, an error occurs.
    Steps to reproduce the problem:
    • Create a controller
    • Create a store and corresponding model. Specify some static data for the store
    • Create a view which is or includes a DataView component. Specify the store in the DataView's config
    • In the controller's launch function, modify some data in one of the model object instances in the store
    The result that was expected:
    • The model object data is updated
    • The DataView component displays the updated data when painted
    The result that occurs instead:
    • The model object data is updated correctly
    • An error occurs in the Ext.dataview.element.Container updateListItem function when attempting to update the item in the DataView corresponding to the model object
    Test Case:


    See attached test application for running example


    Code:
    Ext.define('Test.controller.Controller', {
        extend: 'Ext.app.Controller',
        
        launch: function() {
            console.log('Controller launch');
            
            // Modify a model object instance in the store
            Ext.getStore('Store').first().set('foo', 'baz');
        },
    });

    Debugging already done:
    • It's possible that this is due to the change in the DataView's intialize function where the refresh operation is now deferred until the component is painted, which results in the item not existing when the onStoreUpdate handler is called.
    Workarounds:
    • Create an initialize event handler for the DataView, and either set the desired store (store must not be specified in the config if done this way since the udpate hook will never fire), or call the DataView's refresh function
    Attached Files

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Vote Rating
    847
    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 opened a bug in our bug tracker.

  3. #3
    Sencha User
    Join Date
    Feb 2013
    Posts
    1
    Vote Rating
    0
    totev is on a distinguished road

      0  

    Default Another workaround

    Another workaround


    Hi,

    I'm having the same bug. Encapsulating store.add in a try-catch block and doing an explicit davaview.refresh() helped in my case.

    Hope this gets fixed soon.

    Greetz

Thread Participants: 2