1. #1
    Ext User
    Join Date
    Aug 2009
    Posts
    100
    Vote Rating
    0
    bbxx is on a distinguished road

      0  

    Default Empty folder in TreePanel?

    Empty folder in TreePanel?


    I'm getting strange behavior when adding a folder with no children to a treepanel.

    Code:
    {
     "text":"Empty Folder",
     "id":4,
     "position":2,
     "leaf":false,
     "cls":"folder"
    }
    When I click on the folder, it expands and then the whole treepanel appears under this folder.

    How do I add an empty folder? It's empty now, but I want to add to it later with drag/drop.

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,502
    Vote Rating
    47
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    THe URL you load from must provide the correct children based on the passed id

  3. #3
    Ext User
    Join Date
    Aug 2009
    Posts
    100
    Vote Rating
    0
    bbxx is on a distinguished road

      0  

    Default


    Yes, but that is the problem: I don't want the folder to have any children initially. The URL should return a folder with no children. It will only have children later, when I drag/drop on the client side.

    Quote Originally Posted by Animal View Post
    THe URL you load from must provide the correct children based on the passed id

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,502
    Vote Rating
    47
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Right. So you know why you have a problem then.

  5. #5
    Ext User
    Join Date
    Aug 2009
    Posts
    100
    Vote Rating
    0
    bbxx is on a distinguished road

      0  

    Default


    Yes, I know why I have a problem, but I don't know how to fix it - that's why I came here. How do I indicate that there are no nodes on a folder?

    Quote Originally Posted by Animal View Post
    Right. So you know why you have a problem then.

  6. #6
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,502
    Vote Rating
    47
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    The server script that you specify in the loader returns the array of child nodes when passed the id.

    You must return []

  7. #7
    Ext User
    Join Date
    Aug 2009
    Posts
    100
    Vote Rating
    0
    bbxx is on a distinguished road

      0  

    Default


    Thank you! I got it working by returning an empty array as you suggested.
    PHP Code:
    $path2['children']    = array(); 

Thread Participants: 1