Calculated Fields - Dynamically

Posted by: sravya_tamma on 16 March 2020, 10:14 am EST

  • Posted 16 March 2020, 10:14 am EST

    Hello,

    In Pivot grid, I read that we can add a newly calculated field using getValue function. But i'm looking for something more dynamic.

    Can a user dynamically add new Column C and take a difference of any 2 columns (i.e., A-B ) ?

    Thanks,
    Sravya.

  • Replied 16 March 2020, 8:44 pm EST

    Hi Sravya,

    As per my understanding, you wish to add fields in the PivotGrid dynamically. If this is your requirements, then you can easily create a new instance of the PivotField class and then push it into the fields property of PivotEngine class:
    var fld = new wijmo.olap.PivotField(engine, 'binding', 'header', {});
    fld.getValue = function(item) { ... }
    engine.fields.push(fld);

    PivotField: https://www.grapecity.com/wijmo/api/classes/wijmo_olap.pivotfield.html

    Let me know in case you run into any issues.

    Regards,
    Ashwin
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels