PDA

View Full Version : [CLOSED] template column rendering function of treegrid does not have access to Node



SymSure
Aug 13, 2012, 7:26 PM
Hi,

the example at http://examples2.ext.net/#/TreePanel/Advanced/TreeGrid/

shows how to use templatedcolumn on treegrid, however, in 3.1 we had access to the node property as shown in the code below




var formatHours = function (v,node) { if (v < 1) { return Math.round(v * 60) + " mins"; } else if (Math.floor(v) !== v) { var min = v - Math.floor(v); return Math.floor(v) + "h " + Math.round(min * 60) + "m"; } else { return v + " hour" + (v === 1 ? "" : "s"); } };

However, in V2 the function pass undefined for node.

How can I access the node property of a treegrid when the template function is called as i need to check some properties of the node before generating the Html for the column.

Daniil
Aug 14, 2012, 8:51 AM
Hi,

Please replace


{duration:this.formatHours}
with

{[this.formatHours(values.duration, values)]}

Then you will be able to access other node properties via the second argument.