PDA

View Full Version : Custom Tree cell using model properties? How to access model values in setCell render



jdkida
10 May 2013, 7:10 AM
I would like to adjust the look of the Tree leafs. I basically want it to show the name of the leaf and then in bold italic a count.

The problem I am having is that I am not able to figure out how to access my model properties from the store within the render method.

Here is what I have tried.
BaseTreeNode model = store.getChild(context.getIndex());

However this only gives me back the root folders, not the leafs.. The problem is that the index restarts within each folder...

So my question is how can I access the model property values for every item in my tree.

Here is basically what I am trying to make my Tree look like, one of my model properties is "count", which i would like to show in italic bold next to the name of each leaf item.

ie.

+ Techincal Support
-- Open (5)
-- On Hold (2)
+ Billing
-- Open (10)
-- On Hold (3)

jdkida
10 May 2013, 7:28 AM
So i got it working simply by adding the logic/bold and italic html to my ValueProvider name and then using the setCell / render method with sb.appendHtmlConstant(value).

However this does not seem like the correct way of doing it, it feels like all of this should go into the setCell method... I still do not know how to access my model properties for each item in the tree from the setCell render method... could someone please help.

Thank you