Posted 21 July 2020, 11:54 am EST
Hi,
when refreshing my browser i need to maintain the previous filter in my grid.for that i am saving the filterdefinition in localstorage. but after reloading the itemsource when i resetting the filterdefinition it is not reflecting.
After reseting the filter definition also i manually fired .onFilterApplied() method but it also not reflecting.
Also i tried to reset filterdefinition inside flexinitialised event and also tried it inside the ngAfterviewInit()…but both are not working.
Also my flexgrid have pagination.
following is some piece of code i am using .
In my component.ts file ,
import { WjFlexGridFilter } from ‘@grapecity/wijmo.angular2.grid.filter’;
@ViewChild(‘flex’) flexTable: WjFlexGrid;
@ViewChild(‘filter’) filter: WjFlexGridFilter;
ngOnint(){
this.dashboardService.getListData().then(resp => {
this.listDataFilter(resp);
this.invoiceItemsSource = new CollectionView(this.myData);
this.invoiceItemsSource.pageSize = 10;
this.setPagination(“first”, 0);
this.filter.filterDefinition=localStorage.getItem(“filterdef”);
this.filter.onFilterApplied();
if (this.flexTable) {
this.flexTable.autoSizeColumns();
this.flexTable.rows.defaultSize = 38;
}
}
}
Inside html
<wj-flex-grid #flex [frozenColumns]=“3” (initialized)=“flexInitialized(flex)” [columnGroups]=“allTableColumn” (click)=“gridClickHandler($event,flex)”
[headersVisibility]=“‘Column’” [selectionMode]=“‘Row’” [itemsSource]=“invoiceItemsSource” [itemFormatter]=“itemFormatter” >
<wj-flex-grid-filter #filter [filterColumns]="filtrColumns" (filterChanging)="filterChanging(filter,$event)" ></wj-flex-grid-filter>
</wj-flex-grid>
Regards,
Teenu