Hi Omprakash,
Greetings from Syncfusion.
We have analyzed your requirement. We suggest you to use the “actionBegin” event and “filterByColumn” method of Grid. In the “actionBegin” event handler we will be getting the “currentFilterObject” with “requestType” as “filtering” each time you perform filtering in Grid. You can push this “currentFilterObject” into an array of object variable or save this to a database. Then you can perform filter with this pre-saved values by using the “filterByColumn” method.
Documentation :
To demonstrate the above provided logic, we have prepared a sample. In the below sample, we will be saving the “currentFilterObject” in the “actionBegin” handler to an object variable(ddldata), which will be assigned to a “DropDownList” component. So now each time you perform filtering in Grid, the drop down list will be populated with the “currentFilterObject”. Now the drop down list will be containing the pre-saved filter values. In the change event of dropdown list we will be calling the “filterByColumn” method with arguments provided based on the value selected from the drop down. Please refer the sample link below,
[html]
<ejs-dropdownlist #ddl [dataSource]='ddldata' value='Menu' [fields]='ddlfields' (change)="onChange($event)"></ejs-dropdownlist>
<ejs-grid #grid [dataSource]='data' allowPaging='true' allowFiltering='true'... (actionBegin)="begin($event)" [filterSettings]='filterSettings'>
...
</ejs-grid>
[ts]
public ddlfields: Object = { text: 'filtertime' };
...
public onChange(e: any): void {
this.grid.filterModule.filterByColumn(this.ddlinstance.dataSource[e.value].field,this.ddlinstance.dataSource[e.value].operator,
this.ddlinstance.dataSource[e.value].value); //Call the filterByColumn method with arguments based on the value selected from dropdown.
}
begin(args){
if(args.requestType == "filtering" && (document.activeElement as any).innerText != "CLEAR"){
args.currentFilterObject.filtertime = this.ddldata.length; //Assigning priority in pre-saved filters(this will be displayed in drop down list)
this.ddldata.push(args.currentFilterObject);
this.ddlinstance.refresh() //Refresh the drop down list component to update the drop down list data
}
}
Please get back to us if you need further assistance.
Regards,
Thavasianand S.