extjs - How to add a custom renderer when extending a Ext.grid.TemplateColumn class? -
i'd extend ext.grid.templatecolumn (http://dev.sencha.com/deploy/dev/docs/?class=ext.grid.templatecolumn) class use predefined xtemplate, i'd still able run renderer when 1 passed in.
on understanding, templatecolumn doesn't accept custom renderer, hence i've modified class extend ext.grid.column instead. however, realized renderer passed in function itself. i'm pretty sure can't combine 2 functions one, i'm stuck trying apply xtemplate column, , yet apply passed-in renderer.
i've tried createinterceptor doesn't work well.
this.renderer.createinterceptor(function(value, p, r){ return tpl.apply(r.data); });
will post additional codes if necessary.
the templatecolumn defines own renderer in constructor, override passed in renderer config option. here constructor templatecolumn:
constructor: function(cfg){ ext.grid.templatecolumn.superclass.constructor.call(this, cfg); var tpl = (!ext.isprimitive(this.tpl) && this.tpl.compile) ? this.tpl : new ext.xtemplate(this.tpl); this.renderer = function(value, p, r){ return tpl.apply(r.data); }; this.tpl = tpl; }
if want custom renderer, can createinterceptor or createsequence on renderer after has been set in templatecolumn prototype's constructor... first creating sequence on constructor, , creating interceptor on renderer using renderer passed in on config object... this:
ext.grid.templatecolumn.prototype.constructor = ext.grid.templatecolumn.prototype.constructor.createsequence(function(config) { this.renderer = this.renderer.createinterceptor(config.renderer); });
Comments
Post a Comment