Hi,
We are using igPivotGrid, we need to right align the numeric columns and left align text columns.
Please suggest a method to do so.
Thanks.
Hello,
You can do this in the dataRendering event by adding columnCssClass to the respective numeric column.
Here is a code snippet.
$("#pivotGrid").on("iggriddatarendering", function (evt, ui) {
// return if the column collection is not generated yet
if (ui.owner.options.columns && ui.owner.options.columns.length === 0) {
return;
}
for (var i = 0; i < ui.owner.options.columns.length; i++) {
if (ui.owner.dataSource.data()[0] && $.isNumeric(ui.owner.dataSource.data()[0][ui.owner.options.columns[i].key])) {
ui.owner.options.columns[i].columnCssClass = "right-align";
});
This code snippet analyses the data in the first record of the grid data source and adds a "right-align" CSS class to the column.I'm attaching a complete sample for your reference.
Best regards,Martin PavlovInfragistics, Inc.
Thanks you this works perfect.