0

A Tree that creates its branch ondemand

asked 2006-11-28 10:38:44 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4033539

By: brsmrk

Hi,
this is my scenario and problem:
I want to create a browsable Tree. In other word, each time I open (onOpen) a branch I havof my tree, I'd like it generate automatically its sub-branch.
How can I set dinaically, the attribute onOpen in order to assign a function to it? Below you can see the axample that doesn't work:
<tree width="100%">
<treechildren>
<treeitem open="false" onOpen="doSomething()" >
<custom-attributes name="myListName">default</custom-attributes>
<treerow>
<treecell label="pluto"/>
</treerow>
<treechildren>
<!--Content will be dynamically added in user event handler.-->
</treechildren>
</treeitem>
</treechildren>
<zscript>
void doSomething() {
Treechildren tc = self.getTreechildren();
String myListName = (String)self.getAttribute("myListName");
if(myListName == null) myListName="default";
String[] myList = my.package.and.Class.getList();
for(String item : myList){
Treeitem ti = new Treeitem();
ti.setOpen(false);
ti.setLabel(item);
ti.setAttribute("myListName",item);

//I think that miss something like
that:
//ti.setOnOpen("doSomething()");

Treechildren tcc = new Treechildren();
tcc.setParent(ti);
ti.setParent(tc);
}
}
</tree>

Thank you for your help.

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2006-11-28 12:36:49 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4033627

By: brsmrk

Ok! I found the solution.

link publish delete flag offensive edit

answered 2011-08-14 22:14:00 +0800

cyhsiao gravatar image cyhsiao
12

Hi,
I have the same problem.
What's the solution?

link publish delete flag offensive edit

answered 2011-08-24 05:27:50 +0800

vincentjian gravatar image vincentjian
2245 6

updated 2011-08-24 05:28:04 +0800

Hi,
The sample code works for me in ZK 5.0.7.1, do you still see a problem. If so, would you please post your sample code for test.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2006-11-28 10:38:44 +0800

Seen: 417 times

Last updated: Aug 24 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More