ExtJS - Custom Column Renderer on TreeGrid isn't being fired -
i have extjs treegrid , i'm trying add custom renderer particular column. unfortunately it's not working - event isn't being fired , no warnings given off. couldn't find api treegrid either. has else experienced this?
here's code:
var tree = new ext.ux.tree.treegrid({ title: 'my tree grid', loader: treeloader, columns:[{ header: 'title', dataindex: 'title', width: 500 },{ header: 'testing', width: 100, dataindex: 'testing', renderer: function(value) { console.log('test'); }, align: 'center' }] });
thanks!
there no api treegrid because it's user extension (ext.ux). you'll have take @ source code more information. if don't have source in project, go following page:
http://dev.sencha.com/deploy/dev/examples/treegrid/treegrid.html
and hit "view source" ctrl + u
. there can link treegrid.js
, other supporting js files.
i noticed treegrid
extends treepanel
, in turn extends plain old panel
. there doesn't appear reference gridpanel
, don't believe there column renderer you'd expect if using component. gather, example (tree-grid.js) instead uses xtemplate rendering column data:
var tree = new ext.ux.tree.treegrid({ title: 'core team projects', width: 500, height: 300, renderto: ext.getbody(), enabledd: true, columns:[{ header: 'task', dataindex: 'task', width: 230 },{ header: 'duration', width: 100, dataindex: 'duration', align: 'center', sorttype: 'asfloat', // ================================== // // acts column renderer tpl: new ext.xtemplate('{duration:this.formathours}', { formathours: function(v) { 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'); } } }) // ================================== // },{ header: 'assigned to', width: 150, dataindex: 'user' }], dataurl: 'treegrid-data.json' });
try using xtemplate purposes. if doesn't meet needs you'll have provide more information.
Comments
Post a Comment