My requirements are to filter data inside the grid from outside it.
Thank you in advance!
|
btnClick(args) {
// apply filter
this.grid.filterByColumn('ShipCountry', 'contains', 'fr'); // filterByColumn(field, operator, value)
}
|
|
<ejs-grid
#grid
[dataSource]="data"
allowFiltering="true"
>
</ejs-grid>
|
Thank you!
This is what I'm looking for.
I want to perform dropdown list filter outside the grid but it doesn't work
AYEDI,
Based on your query, you want to apply external filtering in the Grid using the selected value from a DropDownList. To achieve this, the change event of the DropDownList will trigger when a value is selected, allowing you to access the selected value through the event arguments. You can then use these arguments to programmatically invoke the filterByColumn method to apply filtering in the Grid.
While passing the field name inside the filterByColumn method, ensure that the specified field name exists in the Grid's dataSource and that the filtering is applied to the intended column.
For your convenience, we have provided a StackBlitz sample demonstrating how to apply filtering to the Grid using an external DropDownList. Please see the code example and sample below for more details.
|
App.component.ts
public onChange(args: any): void { //change event of dropdownlist //here we have defined the field name as ‘Statut’, based on the dropdown selection value the Statut column gets filtered. this.grid.filterByColumn('Statut', 'equal', args.value); }
|
Sample: https://stackblitz.com/edit/angular-bsapta-g78jynfi?file=app.component.ts,app.component.html
API: https://ej2.syncfusion.com/angular/documentation/api/grid/#filterbycolumn
Please get back to us if you need further assistance.
Regards,
Rajapandi R