I'm trying to figure out how to format a measure as a number and another as a percentage for a flat file source. Is there any way to do this?
Hello Steven,
You can format the values by making use of a custom aggregator on your measures. By manipulating the value returned from your aggregator you can format that value in any way that you want. For an example of this please see the following forum thread:
http://ko.infragistics.com/community/forums/p/85562/428018.aspx#428018
Please let me know if you have any questions or concerns about this implementation.
I just used this technique to format numbers however I encountered an issue: What if I want to activate sorting on these values?
Since the formatted values are string, the sorting function uses a lexical order which is incorrect for numbers...
Is there a formatter function for PivotGrid like the one for Grid? Or a way to set a custom sorting logic?
Hello Valentin,
You can apply formatting on rendering stage, as in the igGrid. Actually the igPivotGrid uses igGrid internally. Try handling igGrid.rowsRendering event where you should set 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 also attaching a sample for your reference.
Hope this helps,Martin PavlovInfragistics, Inc.