Ejs grid filtering.

Suppose i have applied a filter to the ejs grid, and the filtering is done. Now i want to have the data object of the grid after the filtering in my component class. How do i achieve this?

Also, is there a way to catch the filtering event, when i apply a filter.
Please help 

1 Reply

HJ Hariharan J V Syncfusion Team April 10, 2019 10:02 AM UTC

Hi Shounak, 
 
Thanks for contacting us. 
 
Query 1: “Now i want to have the data object of the grid after the filtering in my component class.” 
 
We suggest you to use `currentViewData` property form grid instance for getting filtered data.  Please refer the below code snippets. 
 
[app.component.ts] 
public actionComplete(args: FilterEventArgs): void { 
        if(args.requestType==='filtering')      { 
          console.log('filter action completed'); 
          console.log(this.grid.currentViewData); 
        } 
    } 
 
 
Query 2: “Also, is there a way to catch the filtering event, when i apply a filter.” 
 
You can use `actionBegin` and `actionComplete` event for handling filter actions on grid. Please refer the below samples for both queries. 
 
[app.component.html] 
<ejs-grid #grid [dataSource]='data' allowPaging='true' allowFiltering='true' [pageSettings]="pageOptions" (actionBegin)="actionBegin($event)" (actionComplete)="actionComplete($event)"> 
 
[app.component.ts] 
public actionBegin(args: FilterEventArgs): void {         
        if(args.requestType==='filtering')      { 
          console.log('filter action started'); 
        } 
    } 
 
 
 
Regards, 
Hariharan 


Loader.
Up arrow icon