Success! Looks like we've fixed this one. According to our records the fix was applied for DSGNR-522 in a recent build.
  1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    15
    Vote Rating
    1
    ofueckert is on a distinguished road

      0  

    Default [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:
    Code:
    {"root":{"text":"My Root","children":[{"text":"Child 1","leaf":true},{"text":"Child 2","leaf":true}]}}
    A standard json store loads fine with this data.

    Here the source of the TreeStore object:
    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)]);
        }
    });
    Anybody spotting any mistakes or is it possibly a 1.2 beta issue ?

    best regards,

    Oliver.

  2. #2
    Sencha - Architect Dev Team Phil.Strong's Avatar
    Join Date
    Mar 2007
    Location
    Baltimore, MD
    Posts
    1,733
    Vote Rating
    51
    Phil.Strong is a jewel in the rough Phil.Strong is a jewel in the rough Phil.Strong is a jewel in the rough Phil.Strong is a jewel in the rough

      0  

    Default


    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:
    Code:
    [{"text":"Designer","leaf":true},
    {"text":"1.2","leaf":true},
    {"text":"is awesome!","leaf":true}]
    You found 2 bugs:
    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
    Code:
    root: {
                text: 'Me root',
                id: 'src',
                expanded: true
            }
    see this example and it's code
    Phil Strong
    @philstrong
    #SenchaArchitect
    Sencha Architect Development Team

  3. #3
    Sencha User
    Join Date
    Jun 2011
    Posts
    15
    Vote Rating
    1
    ofueckert is on a distinguished road

      0  

    Default


    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. #4
    Sencha - Architect Dev Team Phil.Strong's Avatar
    Join Date
    Mar 2007
    Location
    Baltimore, MD
    Posts
    1,733
    Vote Rating
    51
    Phil.Strong is a jewel in the rough Phil.Strong is a jewel in the rough Phil.Strong is a jewel in the rough Phil.Strong is a jewel in the rough

      0  

    Default


    Your right can't do this in preview!
    Phil Strong
    @philstrong
    #SenchaArchitect
    Sencha Architect Development Team

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

      0  

    Default 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.

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar