1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    4
    Vote Rating
    0
    DiMoN_TD is on a distinguished road

      0  

    Default Answered: Load TreeStore at once. Etxjs 4

    Answered: Load TreeStore at once. Etxjs 4


    Hi all.

    My question is: How can I load the TreeStore at once?
    Because right now, if I'm using proxy, to get Tree, after rendering, when I expand the leaf, there is one more request with GET parameter 'node' - the id of leaf node. So I need to responce with the tree of this leaf... but I want to load ALL tree at once and no more requests for that tree.

    Right now I have those code:

    Code:
            Ext.define('AdminPanel.TreeNavigation', {              
                extend: 'Ext.data.Model',  
                fields: ['id', 'text', 'leaf', 'children']  
            });
    
    
            var store = Ext.create('Ext.data.TreeStore', {
                            
                            model: 'AdminPanel.TreeNavigation',  
              
                            proxy: {  
                                type: 'ajax',
                                url : 'admin/getTreeNav',
                                reader: {
                                    type: 'json',
                                    root: 'result'
                                }
                            },
                            
                            root: {
                                expanded: true
                            }
                            
                        });
    Thanks

  2. You config root: 'result' for your proxy reader, so try to change 'children' to 'result' in your json data.
    Code:
    {
        "result": [{
            "text": "\u041d\u043e\u0432\u043e\u0441\u0442\u0438",
            "leaf": true,
            "result": []
        }, {
            "text": "\u0410\u043a\u0446\u0438\u0438",
            "leaf": true,
            "result": []
        }, {
            "text": "\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438",
            "leaf": true,
            "result": []
        }, {
            "id": "lang",
            "text": "\u042f\u0437\u044b\u043a",
            "leaf": false,
            "result": [{
                "text": "\u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b",
                "leaf": true,
                "result": []
            }]
        }]
    }

  3. #2
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      1  

    Default


    How does your tree json data look like?

  4. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    4
    Vote Rating
    0
    DiMoN_TD is on a distinguished road

      0  

    Default


    Quote Originally Posted by vietits View Post
    How does your tree json data look like?
    Here it is:

    Code:
    {
        "result": [{
            "text": "\u041d\u043e\u0432\u043e\u0441\u0442\u0438",
            "leaf": true,
            "children": []
        }, {
            "text": "\u0410\u043a\u0446\u0438\u0438",
            "leaf": true,
            "children": []
        }, {
            "text": "\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438",
            "leaf": true,
            "children": []
        }, {
            "id": "lang",
            "text": "\u042f\u0437\u044b\u043a",
            "leaf": false,
            "children": [{
                "text": "\u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b",
                "leaf": true,
                "children": []
            }]
        }]
    }

  5. #4
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    You config root: 'result' for your proxy reader, so try to change 'children' to 'result' in your json data.
    Code:
    {
        "result": [{
            "text": "\u041d\u043e\u0432\u043e\u0441\u0442\u0438",
            "leaf": true,
            "result": []
        }, {
            "text": "\u0410\u043a\u0446\u0438\u0438",
            "leaf": true,
            "result": []
        }, {
            "text": "\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438",
            "leaf": true,
            "result": []
        }, {
            "id": "lang",
            "text": "\u042f\u0437\u044b\u043a",
            "leaf": false,
            "result": [{
                "text": "\u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b",
                "leaf": true,
                "result": []
            }]
        }]
    }

  6. #5
    Sencha User
    Join Date
    Mar 2012
    Posts
    4
    Vote Rating
    0
    DiMoN_TD is on a distinguished road

      0  

    Default


    Yes, it works. Thank you very much!

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi