-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I believe that this is related to tree being rendered on client now.
As it's envolve data binding, tree model, it's kind difficult to provide a reproducible sample, but If needed, I'll try to make a simple project to reproduce this.
In short, it's a with a SimpleTreeModel and a TreeitemRenderer and a initTree() method which generates the model and then assign it to the tree.model
the 1st call to initTree() is on afterCompose, and it works. The problem, is that after a drag n drop action, that I get some data from attributes, and then call initTree() again (which will just replace tree.model with a new one). Then the orange error box appears with
"Failed to process addChd undefined"
Tested with ZK5 21/01/2010 on GC and FF.
Is this info enough? Or should I make a simple reproducible project?
Thanks
Hi,
Please provide a simple sample?
BTW, the ZK 5 release is targeted next week.
Hi Jumper,
I've made a simple test case, not sure is the same error, because in this one the app just hang (js exception on firebug) instead of the orange error.
It's just an tree with a model, and on the drop event re-assign the model. It uses BinaryTreeModel and BigList from zkdemo.
tree.zul
<zk> <label value="ZK Version: ${desktop.webApp.version}"/> Drag n drop to hang <tree id="tree" apply="TreeComposer" /> </zk>
TreeComposer.java
public class TreeComposer extends GenericForwardComposer{ Tree tree; @Override public void doAfterCompose(Component component) throws java.lang.Exception { super.doAfterCompose(component); tree.setTreeitemRenderer(new TreeDragDropRender()); initializeTree(); } public void onDropTreerow() { initializeTree(); } private void initializeTree() { tree.setModel(new BinaryTreeModel(new ArrayList(new org.zkoss.zkdemo.userguide.BigList(10)))); } class TreeDragDropRender implements TreeitemRenderer { public void render(Treeitem item, Object data) throws Exception { if(data != null) { //Contruct treecells Treecell tc = new Treecell(data.toString()); Treerow tr; /* * Since only one treerow is allowed, if treerow is not null, * append treecells to it. If treerow is null, contruct a new * treerow and attach it to item. */ if(item.getTreerow() == null) { tr = new Treerow(); tr.setParent(item); } else { tr = item.getTreerow(); tr.getChildren().clear(); } //Attach treecells to treerow tc.setParent(tr); item.setOpen(true); tr.setDraggable("true"); tr.setDroppable("true"); ComponentsCtrl.applyForward(tr, "onDrop=onDropTreerow"); } } } }
Asked: 2010-01-21 13:15:02 +0800
Seen: 722 times
Last updated: Jan 25 '10