your welcome and again +1 here for your own effort to find it yourself with aid of an example.
chillworld ( 2014-02-26 06:50:14 +0800 )edit-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
i'm using ZK7 with eclipse juno and i'm trying to construct a tree from database data.
I have 2 tables in database: categories & subcategories, the idea is to show all categories in the first level of the tree, then for each category the tree should show its subcategories.
All examples in demo or developper reference are done statically, & i can't find any clear example to implement this.
Can anyone give me a simple example to achieve this, i'ev already retrieved the data from database in a list but i can't find where to put it in the standard methods of the tree component.
Thank you
For mvvm : You need to create a new model that extends AbstractTreeModel.
On fiddle is a nice example (with children): http://zkfiddle.org/sample/3dm77ch/1-MVVM-tree
For MVC I found this example on fiddle :
http://zkfiddle.org/sample/3tqq43h/2-Tree-sample
If you look at the zul you will see that you can convert the mvvm to mvc very easy.
If you don't want to write a renderer you can always use an template.
Doc for that : http://books.zkoss.org/wiki/ZKDeveloper%27sReference/MVC/View/Template/Tree_Template
Greetz chill.
I've managed to make it work with the help of the example you gave.
Thx lot
your welcome and again +1 here for your own effort to find it yourself with aid of an example.
chillworld ( 2014-02-26 06:50:14 +0800 )editthx for your reply, is there any example with MVC please? If i got it right, in this case, the select of data from the base will be implemented in the method getFooRoot of testVM, right?
Yes indeed, but you set the data in the model with the constructor.
chillworld ( 2014-02-24 19:02:03 +0800 )editAsked: 2014-02-24 08:51:58 +0800
Seen: 33 times
Last updated: Feb 26 '14
Any news on zk7 / bootstrap3 ?
Buttons, Tabs not working in zk7 inside Eclipse
Problem with tree and popup (probably a bug)
Portalchildren width is not set properly
How to include the customized Theme? [closed]
zk7 firefox 12 and the look and feel from the combobox
ZK 7: Bootstrap support for combobox/bandbox ?
do you have an model? (like a class Categorie what has a list of SubCategory)
chillworld ( 2014-02-24 10:52:19 +0800 )edityes i have 2 pojos that i use to retrieve data from base, my problem is with the tree class, what should i put in it in order to read the data?
wijdan ( 2014-02-24 12:03:19 +0800 )edit