-
20 Dec 2011 11:28 AM #1
GXT 3.0 Tree - How to display custom icon per tree node?
GXT 3.0 Tree - How to display custom icon per tree node?
I need to display a multi-level tree and show various icons per tree node. In the demo examples all I see are images set at the root tree level, i.e. one TreeStyle for the entire tree. How can I display different icons at each of the tree nodes/levels?
-
20 Dec 2011 4:59 PM #2
Looks like you need to implement an IconProvider and pass it to the Tree.
-
21 Dec 2011 3:54 AM #3
where SideMenuDto is my tree item object. Use your own in your case.Code:tree.setIconProvider(new IconProvider<SideMenuDto>() { @Override public ImageResource getIcon(SideMenuDto p_model) { return .... // your icon choosing algorithm } });
-
21 Dec 2011 10:51 AM #4
Yeah that works perfectly, plus I found I can dynamically update the icons which is what I need to do by calling refresh on the tree. Thanks.


Reply With Quote