-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, I have customized standard zk tree component by extending Tree class and defining the Model and the renderer class. So i m generating three level Tree.
What i want is ,even row should have different background than odd ones. i don't want to change the style from the zul file. style should be applied on creation of tree only. Thanks in advance.
In your renderer you have this :
public void render(Treeitem treeitem, Object data, int index) throws Exception {
}
put this in your renderer, so just see if index is even or not like this :
if (index%2==0) {
treeitem.setStyle("background:red");
} else {
treeitem.setStyle("background:blue");
}
Greetz chill.
Asked: 2014-03-19 11:13:09 +0800
Seen: 14 times
Last updated: Mar 19 '14
Hey @chillworld thanks for your answer, your solution is logically correct , but it isn't working .can you please check the issue. (else than .colorEven{ background:Blue}; should be .colorEven{ background:Blue;} ) if needed should i provide you the code.?
Amol987 ( 2014-03-19 12:11:32 +0800 )editdoes it work when you change the ; from place? I didn't tested it out cause it was pretty simpel, of course then there could be typmistakes coming up :) (IngoB solution you can try also, with that you don't need to set the style tag)
chillworld ( 2014-03-19 14:10:33 +0800 )editNo it doesn't works with the change also, so i m expecting the reason of not working. and the IngoB sol. works fine :)
Amol987 ( 2014-03-19 14:41:55 +0800 )editoke updated to ingoB his solution and upvoted ingoB's answer ;)
chillworld ( 2014-03-19 14:53:42 +0800 )edit