Support Forum
Hi @racing-enedis,
You will have to override the renderedPercentDone
getter defined in PercentDoneMixin.js
. See the getter here https://bryntum.com/products/gantt/docs/api/SchedulerPro/model/mixin/PercentDoneMixin#property-renderedPercentDone.
get renderedPercentDone() {
const value = typeof this.percentDone === 'number' && !isNaN(this.percentDone) ? this.percentDone : 0;
return this.getFormattedPercentDone(value);
}
getFormattedPercentDone(value = 0) {
if (value <= 99) {
return Math.round(value);
}
return Math.floor(value);
}
See our guide about how you can override a method here https://bryntum.com/products/gantt/docs/api/Core/mixin/Override.
Regards,
Ghous
Hello,
The tooltip is implemented with Gnt.template.TaskTooltip class
You need to override its getPercentDoneString
method. Here is for example I extend that class and change result to display twp decimal places:
// A custom tooltip template
Ext.define("Gnt.examples.advanced.template.TaskTooltip", {
extend : 'Gnt.template.TaskTooltip',
getPercentDoneString : function(data) {
var task = data._record;
var value = data._useBaselineData ? task.getBaselinePercentDone() : task.getPercentDone();
// round value to two decimal places
return Math.round(value * 100) / 100;
}
});
Ext.define('Gnt.examples.advanced.view.Gantt', {
extend : 'Gnt.panel.Gantt',
requires : [
'Gnt.examples.advanced.template.TaskTooltip'
],
tooltipTpl : false, // to disable default tooltip
initComponent() {
this.tooltipTpl = new Gnt.examples.advanced.template.TaskTooltip();
this.callParent(arguments);
},
...
Best regards,
Arcady