1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    14
    Vote Rating
    0
    dadaking is on a distinguished road

      0  

    Default Unanswered: Tree empty folder show root node

    Unanswered: Tree empty folder show root node


    Hello,

    I try to show in a Tree panel a Files System.
    I feed my tree with json data and it's work perfectly!

    But when I have an empty folder, the tree folder (when it's deploy) show me the complete tree again.
    In my server I send a json file which doesn't have children properties.

    Anybody has an idea for help me?

    Thanks!

    David

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,078
    Answers
    674
    Vote Rating
    467
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Does it help to call tree.removeAll()?

    Scott.

  3. #3
    Sencha User
    Join Date
    Sep 2012
    Posts
    14
    Vote Rating
    0
    dadaking is on a distinguished road

      0  

    Default


    Thanks for your answer.

    But I don't know how use it. There is my code for the tree:

    Code:
    Ext.onReady(function () {
            var treeStore = Ext.create('Ext.data.TreeStore', {
                proxy: {
                    type: 'ajax',
                    url: '/File/Tree'
                },
                root: {
                    text: 'Files root',
                    id: 'root',
                    expanded: true
                }
            });
            var treeUp = Ext.create('Ext.tree.Panel', {
                id: 'TreeFileSystem',
                title: 'TEST',
                useArrows: true,
                store: treeStore,
                rootVisible: false,
                renderTo: 'Tree',
                height: 350,
                listeners: {
                    itemClick: function (view, record) {
                    }
                }
            });
        });
    and there is an example of my json code

    Code:
    [
    	{"cls":"first-level","expanded":"false","children":[
    		{"cls":"first-level","expanded":"false","children":[
    			{"leaf":"true","text":"..."},
    			{"leaf":"true","text":"..."}
    			],"text":"..."}
    		],"text":"..."},
    	{"text":"..."}
    ]
    When I look the console of firebug, I can see, when I open the empty folder, the tree call again the store withouth attribute.console.JPG
    And there is a screenshot of the tree.
    tree.JPG

  4. #4
    Sencha User
    Join Date
    Sep 2012
    Posts
    14
    Vote Rating
    0
    dadaking is on a distinguished road

      0  

    Default


    Nobody have an idea?

    EDIT: I found the solution, I build my JSON with this achitecture :

    Code:
    {"path":"...","cls":"first-level","expanded":"false","children":[],"text":"..."}
    The cls and children:[] solve the problem.
    Last edited by dadaking; 19 Sep 2012 at 5:34 AM. Reason: I found solution

Thread Participants: 1

Tags for this Thread