extjs - Rally Ext JS change functionalty of existing component -
i trying either override or extend existing component - rally.ui.percentdone component. want provide portfolio item data necessary render using same color coding rally native apps use (the rally health color calculator).
i need function pass correct record. here idea far:
ext.define('custom.percentdone', { requires: ['rally.ui.renderer.template.progressbar.portfolioitempercentdonetemplate', 'rally.util.healthcolorcalculator'], extend : 'rally.ui.percentdone', alias : 'widget.cpercentdone', config: { record: null }, constructor: function(config) { config = this.config; this.rendertpl = ext.create('custom.renderer.template.progressbar.percentdonetemplate', { calculatecolorfn: ext.bind(function(recorddata) { console.log('called custom coloring fn'); var colorobject = rally.util.healthcolorcalculator.calculatehealthcolorforportfolioitemdata(config.record, config.percentdonename); return colorobject.hex; }, this) }); this.renderdata = config; this.mergeconfig(config); this.callparent([this.config]); } }); var custom = ext.create('custom.percentdone', { record: item, percentdonename: 'percentdonebystoryplanestimate', });
but calculate color function not being called instead of default.
i got work overriding:
var percentdonebystorycountel = ext.create("rally.ui.percentdone", { record: item, percentdonename: "percentdonebystorycount", percentdone: item.percentdonebystorycount }); tpl = percentdonebystorycountel.rendertpl; tpl.calculatecolorfn = function (recorddata) { var colorobject = rally.util.healthcolorcalculator.calculatehealthcolorforportfolioitemdata(item, "percentdonebystorycount"); return colorobject.hex; }; ext.override(percentdonebystorycountel, { rendertpl: tpl });
but figure out how via extending component instead.
thanks help.
Comments
Post a Comment