-
5 Nov 2011 1:13 PM #1
NestedList Duplicating Items At the Root Level
NestedList Duplicating Items At the Root Level
The nested list seems to be duplicating items at the root level. The problem does not seem to persist to any levels other than the root.
app.js
categories.jsonCode:Ext.define('Classifieds.model.Category',{ extend: 'Ext.data.Model', fields: [ {name: 'id' , type: 'int'}, {name: 'title' , type: 'string',mapping: 'fileName'}, ] }); Ext.define('Classifieds.store.Categories',{ extend: 'Ext.data.TreeStore', model: 'Classifieds.model.Category', requires: ['Classifieds.model.Category'], autoLoad: true, proxy: { type: 'ajax', root: {}, url: 'categories.json', } }); Ext.define('Classifieds.view.Categories',{ extend: 'Ext.dataview.NestedList', xtype: 'categories', requires: ['Classifieds.store.Categories'], config: { store: Ext.create('Classifieds.store.Categories'), title: 'Categories', displayField: 'title', } }); Ext.application({ name: 'Classifieds', launch: function() { Ext.widget('categories',{ fullscreen: true }); } });
Screen shot 2011-11-05 at 5.10.54 PM.jpgCode:{ "children":[ { "cls":"file", "fileName":"Ajax.js", "id":"./Ajax.js", "leaf":true }, { "cls":"folder", "fileName":"form", "id":"./form", "children": [ { "fileName":"Panel.js", "id":"form\/Panel.js", "leaf":true, "cls":"file" }, { "fileName":"Field", "id":"field\/Field", "cls":"folder", "children": [ { "fileName":"Number.js", "id":"field\/Number.js", "leaf":true, "cls":"file" }, { "fileName":"Text.js", "id":"field\/Text.js", "leaf":true, "cls":"file" } ] } ] }, { "cls":"folder", "fileName":"util", "id":"./util", "children": [ { "fileName":"TapRepeater.js", "id":"util\/TapRepeater.js", "leaf":true, "cls":"file" } ] } ], "text":"." }
-
7 Nov 2011 8:31 AM #2Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,659
- Vote Rating
- 14
Thank you for the report, looks like an issue with the store events.
-
7 Nov 2011 10:46 AM #3
That would make sense considering I have run into store load event handlers being called multiple times upon loading a store. The only work around at this time seems to be manually passing a callback to the load or loadPage methods. In which case the callback is only called once.
-
9 Nov 2011 1:11 PM #4
After countless hours debugging this myself all I can say is:
do not forget to define root as an empty object literal on the TreeStore definition!!!.
huh...
Code:Ext.define('Classifieds.store.Categories',{ extend: 'Ext.data.TreeStore', model: 'Classifieds.model.Category', requires: ['Classifieds.model.Category'], autoLoad: false, root: {}, // CORRECT!!! proxy: { type: 'ajax', // root: [], just stupid why I defined it here... url: 'service/categories3.json' } });
-
9 Nov 2011 6:40 PM #5
This can be closed unless you guys want to implement some type of stupidity exception… lol
-
10 Nov 2011 7:56 AM #6Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,659
- Vote Rating
- 14
It still shouldn't force you to have that empty object configuration, we feel it should handle the issue better.
-
13 Jan 2012 10:44 AM #7Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Haarlem, Netherlands
- Posts
- 1,235
- Vote Rating
- 5
All the issues related to root etc in TreeStore's have been greatly improved as part of the data package cleanup which will be in the next release. Specifying or not specifying an empty root should not break anything and in my testing, it won't cause issues in the future. Thanks for all the time and effort you have put into debugging these issues and providing us with helpful feedback.
-
24 Jan 2012 6:07 AM #8
Yep. Had the same issue with duplicate roots and the empty object did the trick! But I agree it seems more like a hack than a sensible config setting.
Success! Looks like we've fixed this one. According to our records the fix was applied for
TOUCH-988
in
2.0.


Reply With Quote
