Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
765
how to tell a cell's measurement?
posted

Hi experts, I'd like to add some column format by intercepting iggridrowsrendering event using following code. As you can see I'd like to set format only for columns whose column header is '$ Index'. If I have only '$ Index' as a single measurement, it works fine. But if I drag the brand dimension to column, this approach does not work. You can see from the image, '$ Index' measurement become the top level column header, then the brand dimension second level column header, then my data. My code can only detect the direct column header of data, is there a way I can detect 122.9% actually belongs to '$ index' measurement???

$("#pivotGrid").on("iggridrowsrendering", function (evt, ui) {
if (ui.owner.options.columns.length > 0) {
for (var i = 0; i < ui.owner.options.columns.length; i++) {
if (ui.owner.options.columns[i].headerText == "$ Index") {
ui.owner.options.columns[i].formatter = function (val, row) {
if (val === undefined)
return "";
else {
return "<span data-dollarIndex='" + val + "' class='dollarIndex'>" + val + "</span>";
}
};
}
}
}
});

Parents
  • 23953
    Offline posted

    Hello Sathya,

    You don't have context information for the cell measure in the column formatter so you cannot achieve your goal with this code.

    What you can try is to define your customer aggregator function for the '$ Index' measure as described in the "Defining Metadata (igOlapFlatDataSource)" help topic in case you have igOlapFlatDataSource.

    Here is an example code:

    measures: [

    { caption: "Units Sold", name: "UnitsSold", aggregator: function (items, cellMetadata) {

    var sum = 0;

    $.each(items, function (index, item) {

    sum += item.UnitsSold;

    });

    return "$ " + sum;

    } }

    ]

    I'm not sure how it should be done for igXmlaDataSource. You can try setting FormatString property of the measure in your BI project.

    Best regards,
    Martin Pavlov
    Infragistics, Inc.

Reply Children