This is a migrated thread and some comments may be shown as answers.

Increase maximum number of Filter Rules per Column?

3 Answers 308 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Glenn
Top achievements
Rank 1
Glenn asked on 07 Apr 2015, 07:15 PM

Hello Telerik Folks,

 We are trying to do custom filtering on the Client leveraging the Kendo Grid dataSource.Filter() functionality in JavaScript.  We have created a header above our grid that allows a user to select many filter criteria and then we apply them for the user all at once in a JavaScript function.  This approach has many benefits for us in that it allows us to create a cleaner more intuitive interface up top that shows all of the Users' filtering selections together.  It also allows us to leverage Kendo Grid's paging without having to write our own paging and filtering Server side.

The local ApplyFilter() function that pieces together the JSON needed to create the combined multi-column filter into a newTotalFilter string.  We then apply this filter at the end with this logic.

// *** Apply Filter to Grid
if (newTotalFilter.length>0) {
    gridData.dataSource.filter({
        logic: "and",
        filters: newTotalFilter
    });
}
else
{
    var gridData = $("#OurGridID").data("kendoGrid");
    gridData.dataSource.filter({});
}
 

This works great, but we are running into problems when constructing filters that appear to push the limits of what this type of Filtering can do.  Fox example for some columns we provide a checkbox list to allow users to select the items they want to appear below.  This is comparable to a SQL 'IN' statement.  As the Kendo Grid doesn't have an 'IN' filtering functionality we try to piece together several 'Contains' with an 'Or' for that particular column.

So for example, there might be a checkbox list with 

  • ItemA
  • ItemB
  • ItemC
  • ItemD
  • ItemE

 The user might select or Check Items A,B & C.  We would then build out the ​JSON to look like this...

[
  {
    "filters": [
      {
        "field": "ItemsColumn",
        "operator": "contains",
        "value": "ItemA"
      },
      {
        "field": "ItemsColumn",
        "operator": "contains",
        "value": "ItemB"
      },
      {
        "field": "ItemsColumn",
        "operator": "contains",
        "value": "ItemC"
      }
    ],
    "logic": "or"
  }
]

 But when we apply the above JSON we only get the first two rules applied to the ItemsColumn.  We can see the limitation if we go into the UI for the column filter.  It only shows the first two being applied.  (Please see attached image.)

 So what we are wondering is, is there a way to increase or get around this apparent 2 rule limit to the number of filter rules that may be applied to a single column?   ...We would like to construct and apply filters in JSON and not be limited to two rules per column.  

 

 

 

3 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 09 Apr 2015, 04:10 PM
Hello Glenn,

I assume you missed to see that you can create composite filters as demonstrated in the docs here:

http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-filter.filters

This should give you great flexibility even which just AND/OR logic.

Kind Regards,
Petur Subev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Glenn
Top achievements
Rank 1
answered on 10 Apr 2015, 06:43 PM

Hi Petur,

My mistake.  It looks like this is just a limitation of the Kendo Grid's column filtering UI.  Checked again and all three filters do make it against the datasource.  It's just that the Grid Column filter UI can only show the first two.  

 Thanks,
-Glenn

0
Petur Subev
Telerik team
answered on 14 Apr 2015, 06:51 AM
Hello Glenn,

That's right there are only two inputs available in the UI , they are not dynamically generated so even if there are more than two filters applied for that field, just the first two will be shown.

Kind Regards,
Petur Subev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Glenn
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Glenn
Top achievements
Rank 1
Share this question
or