title: Custom filtering with multi-select drop downs
body: <p>I have a grid containing three multiselect controls in the toolbar which are to be used to filter the grid datasource based on selections made. 
  <a href="https://i.stack.imgur.com/3b6P5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3b6P5.png" alt="Grid with multiselect controls in the toolbar"></a></p>
  
  <p>At the moment, I have the below function, fired during a <code>change</code> event in any of the multiselect controls. This function accepts <code>values</code> containing the selected items in the multiselect control changed and <code>filterID</code> which is the <code>field</code> name to be used during the filtering.</p>
  
  <pre><code>function applyClientFilters(values, filterID) {
  var grid = $("#grid").data("kendoGrid");
  var gridDataSource = grid.dataSource;
  var filter = gridDataSource.filter();
  // does the selected drop down contain a value
  // if yes, then apply this filter to the necessary drop down
  // otherwise remove the filter
  if (values.length &gt; 0) {
      // has a filter been setup yet on the datasource?
      if (filter &amp;&amp; filter.filters.length &gt; 0) {            
          // firstly check to see if filter has already been applied and if so remove
          for (var i = 0; i &lt; filter.filters.length; ++i) {
              // check to see if filter field already exists i.e. analyte has already been filtered
              // and check to see if the value at this field already exists as a filtered item
              if (filter.filters[i].field === filterID &amp;&amp; values.indexOf(filter.filters[i].value) &gt; -1) {
                  filter.filters.splice(i, 1);
              }
          }
          // apply new filter(s)
          for (var i = 0; i &lt; values.length; ++i) {
              filter.filters.push({ field: filterID, operator: "eq", value: parseInt(values[i]) });
          }
          gridDataSource.query({
              filter: filter,
              pageSize: 10,
              page: 1,
              group: [{
                  field: "InstrumentName",
                  dir: "asc"
              }, {
                  field: "AnalyteName",
                  dir: "asc"
              }, {
                  field: "MethodName",
                  dir: "asc"
              }]
          });
      }
      else {
          // apply new filter
          gridDataSource.filter({
              logic: "or",
              filters: [
                {
                    field: filterID,
                    operator: "eq",
                    value: parseInt(values),
                }
              ]
          });
      }
  
  } else {
      if (filter &amp;&amp; filter.filters.length &gt; 0) {
          // remove existing filter 
          for (var i = 0; i &lt; filter.filters.length; ++i) {
              if (filter.filters[i].field === filterID) {
                  filter.filters.splice(i, 1);
              }
          }
          gridDataSource.query({
              filter: filter,
              pageSize: 10,
              page: 1,
              group: [{
                  field: "InstrumentName",
                  dir: "asc"
              }, {
                  field: "AnalyteName",
                  dir: "asc"
              }, {
                  field: "MethodName",
                  dir: "asc"
              }]
          });
      }
  }
  }
  </code></pre>
  
  <p>Using only the <code>or</code> logic when filtering is fine with an individual multiselect selection i.e. selecting multiple methods will filter them as expected. However, the logic needs to be <code>and</code> when used across different multiselect controls.</p>
  
  <p><strong>Example</strong></p>
  
  <ul>
  <li>Select 'Analyte A' -> filters grid datasource to only display 'Analyte A'</li>
  <li>Select 'Method A' -> filters grid datasource to display 'Analyte A' <em>and</em> 'Method A'</li>
  <li>Select 'Method B' -> filters grid datasource to display 'Analyte A' <em>and</em> 'Method A' <em>or</em> 'Method B'</li>
  </ul>
  
  <p>Is it possible to combine filter logic operators with Kendo datasource filtering to achieve the above scenario?</p>