PDA

View Full Version : TreeGrid column template



kerthi
21 Aug 2011, 4:26 AM
Hi!

I'm using the ExtJs4 TreeGrid component. The example suggests using XTemplates to render columns:



tpl: Ext.create('Ext.XTemplate', '{duration:this.formatDuration}', {
formatDuration: function(v) {
})


Problem is, i need to pass more than one value to the function. In my case not only duration but also another member from the values object ("id"). How do i do that?

In ExtJs3 ux.TreeGrid it was possible to use something like this:


tpl : function(a) {}

Inside this function one was able to access all members of the values object simply by using this.membername. Inside ExtJs4 XTemplate this points to the XTemplate itself.

thx,
kr kerthi

kerthi
21 Aug 2011, 4:37 AM
This seems to do the trick:


tpl: Ext.create('Ext.XTemplate', '{[this.formatDuration(values.duration,values.id)]}', {
formatDuration: function(v,i) {
})