App.component.ts
import { Component, OnInit, Inject, ViewChild } from '@angular/core';
import { Observable } from 'rxjs';
import { OrdersService } from './order.service';
import { DataStateChangeEventArgs, GroupSettingsModel, FilterSettingsModel, GridComponent } from '@syncfusion/ej2-angular-grids';
import { Predicate, Query, DataUtil } from '@syncfusion/ej2-data';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers: [OrdersService]
})
export class AppComponent {
public data: Observable<DataStateChangeEventArgs>;
public pageOptions: Object;
public state: DataStateChangeEventArgs;
public filterOptions: FilterSettingsModel;
public predicate: any = [];
@ViewChild('grid')
public grid: GridComponent;
constructor( private service: OrdersService) {
this.data = service;
}
public dataStateChange(state: DataStateChangeEventArgs): void {
this.service.execute(state);
}
public ngOnInit(): void {
this.pageOptions = { pageSize: 10, pageCount: 4 };
this.filterOptions = {
columns: [{ field: 'ShipCity', matchCase: false, operator: 'startswith', predicate: 'and', value: 'reims' }]
};
for (var i =0; i< this.filterOptions.columns.length; i++) { //push the filter query to the predicates
this.predicate.push(new Predicate(this.filterOptions.columns[i].field, this.filterOptions.columns[i].operator, this.filterOptions.columns[i].value, true, false ))
}
let where = new Query().where(Predicate.and(this.predicate))
let state = { skip: 0, take: 10, where: where.queries[0] };
this.service.execute(state); //it will helps to pass the filter query to datastatechange event
}
}
|
Hi,
Can we use excel like filter with infinite scrolling ?
Hi Aparna,
Greetings from Syncfusion support
After reviewing your shared information, we could see that you are facing the problem with filter popup. We have already discussed about your requirement in our public forum threads. Please refer the below public forum thread for more information.
Regards,
Rajapandi R