Expand all Row and Cols in Pivot Grid

1 Answer 160 Views
Grid
yves
Top achievements
Rank 1
yves asked on 05 Dec 2022, 04:44 PM

When trying to expand all rows in a Pivot Grid as follow:

const defaultRowAxesPivotGridAxis[] = [
  { name: ['[Geography].[City]'],expand: true  },
  { name: ['[Product].[Category]'],expand: true }
];

 

The "Geography" field is expanded whereas the "Product" field is not.

See the attached image for a visual description of the problem

The question is : how does one expand all rows/cols in a pivot grid in React?

1 Answer, 1 is accepted

Sort by
0
Filip
Telerik team
answered on 07 Dec 2022, 09:58 AM

Hello, Yves,

This can be currently achieved by iterating over the defaultRowAxes using Object.keys and adding expand: true to each item:

const defaultRowAxes = [
  {
    name: ['Region'],
    expand: true,
  },
  {
    name: ['Country'],
  },
].concat(
  Object.keys(countries).map((country) => {
    return {
      name: ['Region&' + country, 'Country'],
      expand: true,
    };
  })
);

Here is an example that showcases this approach:

https://stackblitz.com/edit/react-tkrsqq-w4wcby?file=app/main.jsx

I hope this helps.

Regards,
Filip
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

yves
Top achievements
Rank 1
commented on 07 Dec 2022, 10:00 AM

Great. Thank you very much Filip.
Tags
Grid
Asked by
yves
Top achievements
Rank 1
Answers by
Filip
Telerik team
Share this question
or