Format Total to Two Decimal Places

Hello,

I would like to format the “total” footer in Pivot to two decimal places (as opposed to the three that come by default).

I found Luca’s discussion regarding text alignment:
http://forum.webix.com/discussion/7787/format-and-alignment-total-in-pivot

Which I can replicate fine in my project, however adding this extra line to onBeforeRender does not bring the desired result:
columns[i].footer.format = function(value){ return parseFloat(value).toFixed(2); };

http://webix.com/snippet/9b137ad5

Any clues on how to achieve this? Again, I would only like to parse the total, not all of the rows.

Thanks,
Ian

Footer doesn’t support the format property, but you can configure its template as follows:

http://webix.com/snippet/5dae437a

Please check also the docs about number formatting.

Magnificent, many thanks!

The example in the snippet doesn’t seem to be working in the latest version of the pivot? The numbers in the footer is not formatted as expected. Is there a workaround for this?

@johan for now, the footer is an object with the following parameters:

{
  $pivotValue: 1558.7659999999998, // actual result
  $pivotOperation: "sum",
  text: "1558.766" // text that will be displayed
}

css is still an optional parameter that can be added by hand. As for the format, it’s possible to redefine thetext as follows:

http://webix.com/snippet/a5b81dae

Excellent, it’s working thanks