Skip to content

[IgxGrid] - How do you groupby columns that are autogenerated? #12717

Discussion options

You must be logged in to vote

Hello @mddifilippo89

When we have auto-generated columns and we want to group them, what we can do is to handle the ngAfterViewInit hook and, when loading and rendering the grid, access its columns. We can then iterate through them and set each groupable property to true.

<igx-grid
    #grid
    [data]="data"
    [autoGenerate]="true"
    width="100%"
    height="600px"
    [showGroupArea]="true"
  ></igx-grid>
public ngAfterViewInit() {
    this.grid.columns.forEach((column) => {
         column.groupable = true;
    });
} 

Here could be found a small sample demonstrating the above mentioned approach.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kacheshmarova
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #12716 on March 06, 2023 12:12.