Results 1 to 3 of 3

Thread: ext 6.6 modern : please help ! tree : adding leaf when json doesn't have "children"..

  1. #1
    Sencha Premium User
    Join Date
    Jun 2018
    Posts
    21
    Vote Rating
    0
      0  

    Default ext 6.6 modern : please help ! tree : adding leaf when json doesn't have "children"..

    Hello all...

    (extjs 6.6 modern)

    I have to manage a tree of folders...
    I have a viewModel store which loads a json from the proxy of a model

    My problem is that, as you can see, the json I receive doesn't contain the "leaf" and the "iconCls" configs in it.
    I don't know what is best practice to insert "leaf:true" and an iconeCls when a folder doesn't have "children[...]"...

    here is the server response json :
    PHP Code:
    {
            
    "success" true,
            
    "children":
            [
                {
                    
    "folderId"1212,
                    
    "label""mon projet 2017"
                
    },
                {
                   
    "folderId"123,
                    
    "label""mon projet 2018",
                    
    "children": [
                            {
                                    
    "folderId"541,
                                    
    "label""mon sous proj"
                            
    },
                            {
                                    
    "folderId"412,
                                    
    "label""mon autre sous proj"
                            
    },
                            {
                                    
    "folderId"541,
                                    
    "label""Encore un",
                                    
    "children": [
                                            {
                                                    
    "folderId"451,
                                                    
    "label""et son enfant"
                                            
    }
                                    ]
                            }
                    ]
                },
    ... 
    thank you !!!
    ;o)

  2. #2
    Sencha Premium Member volkans80's Avatar
    Join Date
    Mar 2012
    Location
    Ankara, Turkey
    Posts
    88
    Answers
    2
    Vote Rating
    4
      -1  

    Default

    Do you use treestore?

  3. #3
    Sencha Premium User
    Join Date
    Jun 2018
    Posts
    21
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by volkans80 View Post
    Do you use treestore?
    Yes, I'm using a store in my viewmodel which use a model 'FolderTree' (my proxy is in my model)

    PHP Code:
    stores: {
            
    vmStoreFolderTree:
           {
                
    type'tree',
                
    model'FolderTree',
                
    rootVisibletrue,
                
    root:{
                    
    text'theRoot!!!',
                   
    expandedtrue
               
    }
            }
        } 

Similar Threads

  1. preformatted JSON how to add "leaf:true" if no children
    By jonsykes in forum Ext: Discussion
    Replies: 5
    Last Post: 23 Aug 2011, 1:11 PM
  2. Replies: 0
    Last Post: 20 May 2011, 4:54 PM
  3. [Solved 3.0.0]Drop treenodes onto "leaf" nodes in the same tree
    By saJoshua in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 13 Sep 2009, 2:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •