Posted 12 March 2018, 11:25 pm EST
Hi,
Angular 5,
TypeScript,
Wijmo : 5.20173.405
I would like to preserve filtering in the flex grid component. For example, I want to filter the flex grid and after I find the item in the flex grid, I will navigate to the details page. But If I do Cancel on the details page, I will go back on the list of items, this should be filtered list of items.
I have already tried the next code:
<wj-flex-grid #flex [itemsSource]="data" (updatingView)="updatingView(flex,$event)">
<wj-flex-grid-filter #filter></wj-flex-grid-filter>
</wj-flex-grid>
import * as wjcGridFilter from 'wijmo/wijmo.grid.filter';
export class AppComponent {
public data: wjCore.CollectionView;
private savedInfo: Object;
private _dataSvc: DataSvc;
constructor( @Inject(DataSvc) _dataSvc: DataSvc) {
this._dataSvc = _dataSvc;
this.data = new wjCore.CollectionView(this._dataSvc.getData(10));
}
@ViewChild('filter') public filter: wjcGridFilter.FlexGridFilter;
ngAfterViewInit() {
if (localStorage.getItem('saveInfo') !== null) {
let savedInfo = JSON.parse(localStorage.getItem('saveInfo'));
this.filter.filterDefinition = savedInfo.filter; // ?? this.filter is always undefind ?????
}
}
updatingView(s: wjGrid.FlexGrid, e: wjCore.CancelEventArgs) {
this.savedInfo = {
pageIndex: this.data.pageIndex,
pageSize: this.data.pageSize,
sortDescriptions: this.data.sortDescriptions,
filter: this.filter.filterDefinition
}
localStorage.setItem('saveInfo', JSON.stringify(this.savedInfo));
}
}
this.filter is always undefined.
Can you provide me a plunker example how to do this properly?
Thank you