How to define pivot panel fields and their format with custom header

Posted by: singh.jagdeep91 on 22 January 2019, 3:11 am EST

    • Post Options:
    • Link

    Posted 22 January 2019, 3:11 am EST

    Hi, How to define pivot panel fields and their format with custom header if i set autoGenerateFields to false.

    For now it takes all keys in the datasource obj. But i want to show only 5-6 fields only out of 10 from datasource. And also how to define their format like currency, number, percentage and date.

    Also after defining these then how to add few of the fields to rowFields & valueFields of Pivot Panel.

    For Example :

    let dataSource = [

    {id : 1, name : “Persone Name”, age : 30, dateOfBirth : ‘10/12/1880’, assets : 43724637 },

    {id : 1, name : “Persone Name”, age : 30, dateOfBirth : ‘10/12/1880’, assets : 43724637 },

    {id : 1, name : “Persone Name”, age : 30, dateOfBirth : ‘10/12/1880’, assets : 43724637 },





    ]

    I want to show only Name, Age & Assets with type String, Number & currency respectively. And different header instead of Name, Age & Assets.

    And i want to add name in the rowFields & assets in the valueFields.

    Let me know how to do that.

  • Posted 22 January 2019, 4:25 am EST

    Hi,

    Please refer to the following sample which demonstrates how we could customize the fields shown and their properties:

    https://demos.wijmo.com/5/PureJS/LearnWijmo/LearnWijmo/#vce89zp2

    Please let us know if you face any further issues.

    ~Sharad

  • Posted 23 January 2019, 3:59 am EST

    Thanks Sharad for your reply.

    I am using Angular2+. And when i try to define fields it says “Cannot set property fields which has only a getter”. Can you please let me know how to do that in Angular2.

    I have gone through https://demos.wijmo.com/5/Angular2/OlapIntro/OlapIntro/. But couldn’t find any way to define and configure fields.

  • Posted 24 January 2019, 12:53 am EST

    It seems that you are trying to assign a value to the fields collection after pivotEngine is created. This is not allowed, what we should do instead is use different methods of the pivotFieldCollection(like push, remove, splice) to modify the fields collection.

    Please refer to the following sample which demonstrates the same:

    https://stackblitz.com/edit/angular-f3tz5a?file=app%2Fapp.component.ts

Need extra support?

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

Learn More

Forum Channels