Search code examples
groupinginfragisticsignite-uiiggrid

IgGrid - How to execute multiple grouping in code?


In my project I have to create my own multiple sorting and multiple grouping dialogs. Basically user can choose which columns should be included, select order and direction of operation.

For multiple sorting I use this function and it works

 .igGridSorting( "sortMultiple", [exprs:array] );

The problem is now with grouiping. Is there any function which will behave similary? I mean executing with array of grouping expressions (which define columns to group by, order of grouping and direction of grouping (acs / desc)) as parameter? (this feature is supported by ignite-ui built-in dialog)

In the documentation I have found:

 .igGridGroupBy( "groupByColumns" );

The description is "Adds a column to the group by columns list, executes the group by operation and updates the view."

But there is nothing about how add this columns.


Solution

  • There is no public API method for grouping multiple columns.

    The build-in dialog sets the expressions into the datasource and also takes care to rebind the grid and rebuild the grouping area. Unfortunately none of this is exposed as public API.

    So the easiest approach would be to go around the columns you need to group and invoke groupByColumn for each column.

    Another thing you can do is to re-create the grid with another set of columnSettings for the GroupBy feature.