-
1 Aug 2011 2:55 AM #1
[1.2 Beta] json TreeStore undefined records loaded
[1.2 Beta] json TreeStore undefined records loaded
Hi,
I am trying to populate a Tree View Panel using a jsonTreeStore store.
I always get an "undefined records loaded" message when I try to load the store with my sample data.
Somehow, I just can't spot what I am doing wrong. Here the json raw data returned by the service:
A standard json store loads fine with this data.Code:{"root":{"text":"My Root","children":[{"text":"Child 1","leaf":true},{"text":"Child 2","leaf":true}]}}
Here the source of the TreeStore object:
Anybody spotting any mistakes or is it possibly a 1.2 beta issue ?Code:Ext.define('deviceTreeStoreUi', { extend: 'Ext.data.TreeStore', constructor: function(cfg) { var me = this; cfg = cfg || {}; me.callParent([Ext.apply({ autoLoad: true, storeId: 'deviceTreeStore', proxy: { type: 'ajax', url: 'tree.php', reader: { type: 'json' } } }, cfg)]); } });
best regards,
Oliver.
-
2 Aug 2011 7:25 AM #2
Ok so I believe the the tree is giving itself a root and thus you can't describe it in your json.
Change your json returned to:
You found 2 bugs:Code:[{"text":"Designer","leaf":true}, {"text":"1.2","leaf":true}, {"text":"is awesome!","leaf":true}]
bug 1. Ext.data.TreeStore doesn't have an autoLoad (we'll remove it). FYI I believe it should have this.
bug 2. When loading the records from designer on a tree store 'undefined records loaded' was reported. I've fixed this and on the next build it will simply read 'records loaded'. I could cascade the tree to discover the number of records but I worry about monster sized data sets.
Thanks for your help. With the above change you should be able to get going. In preview and on export I had to call MyJsonTreeStore.load() to get it to load properly.
You can also (export) add
see this example and it's codeCode:root: { text: 'Me root', id: 'src', expanded: true }Phil Strong
@philstrong
#SenchaArchitect
Sencha Architect Development Team
SenchaCon or bust!
Known Bugs in Architect Latest
-
3 Aug 2011 5:26 AM #3
Thanks Phil!
Just out of interest:
Thanks for your help. With the above change you should be able to get going. In preview and on export I had to call MyJsonTreeStore.load() to get it to load properly.
How do you call a function in preview ?
Ollie.
-
4 Aug 2011 11:37 AM #4
Your right can't do this in preview!
Phil Strong
@philstrong
#SenchaArchitect
Sencha Architect Development Team
SenchaCon or bust!
Known Bugs in Architect Latest
-
26 Jan 2012 7:12 AM #5
Shouldn't we be able to specify a root object for a TreeStore?
Shouldn't we be able to specify a root object for a TreeStore?
Shouldn't we be able to specify a root object in a TreeStore through Designer? Manually altering the generated store script to specify the root object in the TreeStore was the only way I could get the JSON data to load with rootVisible=true. Given that when you export the store from Designer it gets overwritten, it seems that Designer should allow a root object to be specified.
Success! Looks like we've fixed this one. According to our records the fix was applied for
DSGNR-522
in
Designer 1.2.3.


Reply With Quote