Hello,I'm evaluating igPivotView and I would like to ask you a question.
Is there any possibility to adjust measure field settings at runtime, like in Microsoft Excel PivotTable (where this function is called Value Field Settings)?For each measure, the user should be able to modify aggregate function and numeric format.
Thank you, regards. Maria
Hello Maria,
The function itself is not documented in our API docs, but the igGrid.column.format option uses it under the hood so you can use its reference instead.
What I think the correct format to use is:
$.ig.formatter(parseFloat(val), 'number', '#.##');
Hope this helps,Martin PavlovInfragistics, Inc.
Hi Martin,thank you for your sample.
I went crazy looking for $.ig.formatter API reference, but finally I guess I've found the correct call to set two decimal places for my numbers:
return $.ig.formatter(parseFloat(val), 'number', '#,##0.00'); /* always 2! */
Is it correct? Where I can found the reference for this function?Thanks again, Maria
First you need to reference the Italian regional file "modules/i18n/regional/infragistics.ui.regional-it.js" after the "infragistics.lob.js". Then in the igGrid.rowsRendering you should handle the igGrid.column.formatter callback and in there call the $.ig.formatter function like this:
$("#pivotGrid").on("iggridrowsrendering", function (evt, ui) {
for (var i = 0; i < ui.owner.options.columns.length; i++) {
ui.owner.options.columns[i].formatter = function (val, rec) {
return $.ig.formatter(parseFloat(val), "number", "numeric");
};
}
});
I'm attaching an updated sample.
Best regards,Martin PavlovInfragistics, Inc.
Hi Martin,thank you. I'll use your suggestion to update cell format.
If I would like to format a number as "1.234,53" (italian settings, with "." as thousands separator and "," as decimal separator) which format should I specify?
Thanks again,Maria
There is no out of the box functionality to change "value field settings" in igPivotGrid, but this functionality can be achieved using the API.For example changing the "summary value" require the data source to be recreated with the new configuration.To change the format you need to handle the igGrid.rowsRendering event and modify the columns's format optionI'm attaching a sample to demonstrate both scenarios.