Pivotgrid data to be displayed in order

Posted by: ykumar23 on 5 December 2018, 10:27 am EST

    • Post Options:
    • Link

    Posted 5 December 2018, 10:27 am EST - Updated 3 October 2022, 8:16 pm EST

    Hi,

    I have a pivotgrid which displays Country, Product in rows. But the data in each of these rows should be displayed in order.

    Countries are showing in order but when the 2nd row ( product) is having numbers in the text, rows are not displaying in order.

    Also if 3rd rows is added the same result is displayed.

    And if I write my own sort comparator, grouping is not happending. (In the following case, it is grouping product according to company)

    Could you please share any solution for this issue when 2 and 3 rows are added ?

    Please find the sample in the following link. (Pls refresh 5, 6 times for product grouping according to county).

    https://stackblitz.com/edit/angular-ksttpo?embed=1&file=app/data-svc.service.ts

  • Posted 7 December 2018, 3:26 am EST

    Hi,

    You need to define the sortComparer function on PivotField.

    Please refer to the following code snippet and sample:

    var field=panel.fields.getField('Product');
        field.sortComparer = (a,b)=>{
          // required implementation of sortComparer
        }
    

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

    ~Sharad

Need extra support?

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

Learn More

Forum Channels