-
7 Jan 2013 2:50 PM #1
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
- Google Chrome 23.0.1271.97 m
- Playbook 2.0 Webkit
- html
- 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.
- 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 model object data is updated
- The DataView component displays the updated data when painted
- 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
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.
- 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
-
8 Jan 2013 7:20 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
Thanks for the report! I have opened a bug in our bug tracker.
-
21 Mar 2013 12:35 AM #3
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
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.


Reply With Quote