Grid filtering based on range of values

Hello, I'm trying to filter a couple columns of my grid for values in between two numbers. What am I doing wrong?

grid.filterByColumn('ColumnOne', 'greaterThan', valOne, 'and');
grid.filterByColumn('ColumnOne', 'lessThan', valTwo, 'and');
grid.filterByColumn('ColumnTwo', 'greaterThan', valOne, 'and');
grid.filterByColumn('ColumnTwo', 'lessThan', valTwo, 'and');

1 Reply

PS Pavithra Subramaniyam Syncfusion Team May 24, 2023 04:44 AM UTC

Hi Zachary,


Thanks for contacting Syncfusion support.


You can achieve your requirement by setting the “filterSettings.columns” property. Please refer to the below code example and the API link for more information.


grid.filterSettings.columns = [

       { field: "OrderID", value: 10248, operator: "greaterthan", predicate: 'and' },

       { field: "OrderID", value: 10251, operator: "lessthan", predicate: 'and' },

       { field: "Freight", value: 10, operator: "greaterthan", predicate: 'and' },

       { field: "Freight", value: 15, operator: "lessthan", predicate: 'and' }]

 


https://ej2.syncfusion.com/javascript/documentation/api/grid/filterSettingsModel/#columns

https://ej2.syncfusion.com/javascript/documentation/api/grid/predicateModel/


Please get back to us if you need further assistance on this.


Regards,

Pavithra S

If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Loader.
Up arrow icon