PDA

View Full Version : Empty folder in TreePanel?



bbxx
8 Oct 2009, 8:12 PM
I'm getting strange behavior when adding a folder with no children to a treepanel.



{
"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.

Animal
8 Oct 2009, 9:04 PM
THe URL you load from must provide the correct children based on the passed id

bbxx
8 Oct 2009, 9:08 PM
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.


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

Animal
8 Oct 2009, 9:29 PM
Right. So you know why you have a problem then.

bbxx
8 Oct 2009, 9:34 PM
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?


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

Animal
9 Oct 2009, 12:13 AM
The server script that you specify in the loader returns the array of child nodes when passed the id.

You must return []

bbxx
9 Oct 2009, 9:07 AM
Thank you! I got it working by returning an empty array as you suggested.

$path2['children'] = array();