ExtJS adding children to an empty async treenode
I've noticed that in ExtJS (version 3) if you create an async treenode followed by a page refresh, the resulting node won't allow a child node to be moved / added into it. On attempting to drag and drop a node the text turns to italics without any further info being logged to the console, and the moved node moves back to its original position.
This seems a little strange due to the fact that if you create a new async node and then add a child without refreshing the page, the node is added without a problem.
On further inspection, it appears that on refreshing the page the resulting node config is showing: loaded: false
, whereas this is loaded: true
if you create the node and don't refresh the page.
Is there any way to force an async treenode to load even i开发者_JAVA技巧f it doesn't have any children ?
Thanks
The key is a "leaf" parameter. You'll not be able to drop items if target node has leaf:true.
You can try to specify leaf:false, loaded:true
for your leaf nodes. In this case the loaded:true
is specified to not show arrow or plus sign beside leaf nodes.
For anyone with a similar problem where they can't drop children on an empty asynctreenode...
The workaround I've had to use is to append a dummy node to force the asynctreenode to load and subsequently remove the dummy after the asynctreenode has loaded. Slightly convoluted but prevents modification to the core.
精彩评论