Skip to content

Commit e569f09

Browse files
authored
Merge pull request #6157 from IgniteUI/hanastasov/grid-state
feat(grid): Add state persistence directive igxGridState
2 parents d6c950b + 5178db6 commit e569f09

19 files changed

+1890
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ All notable changes for each version of this project will be documented in this
1717

1818
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
1919
- **Behavioral Change** - Pinning columns is no longer automatically prevented when the pinning area would exceed the size of the grid.
20+
- `igxGridState` directive added to make it easy for developers to save and restore the grid state. The directive exposes the `getState` and `setState` methods to save/restore the state and an `options` input property to exclude features.
2021
- `IgxCarousel`:
2122
- **Breaking Changes** -The carousel slides are no longer array, they are changed to QueryList.
2223
- **Behavioural change** - When slides are more than 5, a label is shown instead of the indicators. The count limit of visible indicators can be changed with the input `maximumIndicatorsCount`

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ You can find source files under the [`src`](https://github.com/IgniteUI/igniteui
4343
|input group|Available|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/input-group/README.md)|[Docs](https://www.infragistics.com/products/ignite-ui-angular/angular/components/input_group.html)|Animations|Available|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/animations/README.md)||
4444
|linear progress|Available|[Readme](https://github.com/IgniteUI/igniteui-angular/tree/master/projects/igniteui-angular/src/lib/progressbar)|[Docs](https://www.infragistics.com/products/ignite-ui-angular/angular/components/linear_progress.html)|dataUtil|Available|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/data-operations/README-DATAUTIL.md)||
4545
|list|Available|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/list/README.md)|[Docs](https://www.infragistics.com/products/ignite-ui-angular/angular/components/list.html)|dataContainer|Available|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/data-operations/README-DATACONTAINER.md)||
46-
|month picker|Available|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/calendar/month-picker/README.md)|[Docs](https://www.infragistics.com/products/ignite-ui-angular/angular/components/month_picker.html)|||||
46+
|month picker|Available|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/calendar/month-picker/README.md)|[Docs](https://www.infragistics.com/products/ignite-ui-angular/angular/components/month_picker.html)|IgxGridState|Available|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/grids/README.md)|[Docs](https://www.infragistics.com/products/ignite-ui-angular/angular/components/grid/state_persistence.html)||
4747
|navbar|Available|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/navbar/README.md)|[Docs](https://www.infragistics.com/products/ignite-ui-angular/angular/components/navbar.html)|||||
4848
|navigation drawer|Available|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/navigation-drawer/README.md)|[Docs](https://www.infragistics.com/products/ignite-ui-angular/angular/components/navdrawer.html)|||||
4949
|radio|Available|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/radio/README.md)|[Docs](https://www.infragistics.com/products/ignite-ui-angular/angular/components/radio_button.html)|||||

projects/igniteui-angular/src/lib/grids/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,3 +494,18 @@ import {
494494
|Name|Return Type|Description|
495495
|--- |--- |--- |
496496
|`update(val: any)`|void|Emits the `onEditDone` event and updates the appropriate record in the data source.|
497+
498+
## IgxGridState Directive
499+
500+
### Getters/Setters
501+
502+
|Name|Type|Getter|Setter|Description|
503+
|--- |--- |--- |--- |--- |
504+
|`options`|IGridStateOptions|Yes|Yes|Features to be exluded from tracking in the IgxGridState directive.|
505+
506+
### Methods
507+
508+
|Name|Return Type|Description|
509+
|--- |--- |--- |
510+
|`getState(serialize: boolean, feature?: string | string[])`|IGridState, string|Gets the state of a feature or states of all grid features, unless a certain feature is disabled through the `options` property..|
511+
|`setState(val: IGridState | string)`|void|Restores grid features' state based on the IGridState object passed as an argument.|

projects/igniteui-angular/src/lib/grids/common/shared.module.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { IgxButtonGroupModule } from '../../buttonGroup/buttonGroup.component';
2020
import { IgxProgressBarModule } from '../../progressbar/progressbar.component';
2121
import { IgxSelectModule } from '../../select/select.module';
2222
import { IgxDropDownModule } from '../../drop-down/index';
23+
import { IgxGridStateModule } from '../state.directive';
2324

2425

2526
@NgModule({
@@ -44,7 +45,8 @@ import { IgxDropDownModule } from '../../drop-down/index';
4445
IgxDropDownModule,
4546
IgxButtonGroupModule,
4647
IgxProgressBarModule,
47-
IgxSelectModule
48+
IgxSelectModule,
49+
IgxGridStateModule
4850
],
4951
exports: [
5052
CommonModule,
@@ -59,6 +61,7 @@ import { IgxDropDownModule } from '../../drop-down/index';
5961
IgxForOfModule,
6062
IgxTemplateOutletModule,
6163
IgxTextHighlightModule,
64+
IgxGridStateModule,
6265
IgxTextSelectionModule,
6366
IgxCheckboxModule,
6467
IgxBadgeModule,

projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ describe('IgxHierarchicalGrid Runtime Row Island change Scenarios #hGrid', () =>
11291129

11301130
});
11311131

1132-
describe('IgxHierarchicalGrid custom template', () => {
1132+
describe('IgxHierarchicalGrid custom template #hGrid', () => {
11331133
configureTestSuite();
11341134
let fixture: ComponentFixture<IgxHierarchicalGridCustomTemplateComponent>;
11351135
let hierarchicalGrid: IgxHierarchicalGridComponent;
@@ -1149,7 +1149,7 @@ describe('IgxHierarchicalGrid custom template', () => {
11491149
hierarchicalGrid = fixture.componentInstance.hgrid;
11501150
}));
11511151

1152-
it(' should allow setting custom template for expand/collapse icons', async() => {
1152+
it(' should allow setting custom template for expand/collapse icons', async() => {
11531153
let rows = hierarchicalGrid.dataRowList.toArray();
11541154
for (const row of rows) {
11551155
const expander = row.nativeElement.querySelector('.igx-grid__hierarchical-expander');

projects/igniteui-angular/src/lib/grids/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ export * from './grid-common.module';
1010
export { IColumnVisibilityChangedEventArgs } from './hiding/column-hiding-item.directive';
1111
export * from './hiding/column-hiding.component';
1212
export * from './pinning/column-pinning.component';
13+
export * from './state.directive';

0 commit comments

Comments
 (0)