operators.string.custom.handler Function

The handler of the operator.

Example - set the operator

<div id="filter"></div>
<br /><br />
<script>
  var data = [
      { name: "Jane Doe", age: 30 },
      { name: "John Doe", age: 33 }
    ];

  var dataSource = new kendo.data.DataSource({
    data: data
  });

  $("#filter").kendoFilter({
    dataSource: dataSource,
    expressionPreview: true,
    fields: [
      { name: "age", type:"number", label: "Age" },
      { name: "name", type:"string", label: "Name", operators: {
          string:{
            customOperator:{
              text: 'Custom operator',
              handler: customOperatorHandler
            }
          }
        }
      }
    ]
  });

  function customOperatorHandler(itemValue, filterValue){
    return itemValue.indexOf(filterValue) > 1;
  }
</script>
In this article