import { Component, ViewContainerRef, ViewChild, ViewChildren, ViewEncapsulation } from '@angular/core'; import { IntegralUISelectionMode } from '../../integralui/components/integralui.core'; import { IntegralUIGrid } from '../../integralui/components/integralui.grid'; @Component({ selector: '', template: `
An example of Grid where data is arranged dynamically by different groups.
Initially, there is one group present, the 'Genre' group. But you can create other groups by:
Once a group is created, the corresponding column is removed from the view. And vice versa, once group is removed, the column will re-appear in the view. This is customizable and handled in sample code by groupAdded and groupRemoved events.
When you have more than one group present, you can reorder them by click and drag over the group title. The grid data will auto-update based on current group order. This allows you to dynamically change the Grid data.
Depending on data in each column, a different template for group data is used. This is customizable in HTML, depending on group.valueID field, which corresponds to the column id value. In combination with group.value, you can create different templates for each group separatelly.
Rating is displayed using the IntegralUI Rating component. By changing a rating value in rows, grouping will also change, based on new values.
Some columns like 'Title' and 'Released' are excluded from grouping functionality. This is determined in sample code by allowGrouping field of column object, which for these columns is set to false.
For more information check out the source code of this sample (grid/grid-grouping.ts) file.