\Kendo\UI\Filter
A PHP wrapper for Kendo UI Filter.
Inherits from \Kendo\UI\Widget.
Usage
To use Filter in a PHP page instantiate a new instance, configure it via the available
configuration methods and output it by echo
-ing the result of the render method.
Using Kendo Filter
<?php
// Create a new instance of Filter and specify its id
$filter = new \Kendo\UI\Filter('Filter');
// Configure it
$filter->applyButton(true)
// Output it
echo $filter->render();
?>
Methods
applyButton
If set to true the filter will display a button which when clicked will apply filtering over the datasource.
Returns
\Kendo\UI\Filter
Parameters
$value boolean
Example
<?php
$filter = new \Kendo\UI\Filter('Filter');
$filter->applyButton(true);
?>
change
Fired when the generated filter expression is changed. For additional information check the change event documentation.
Returns
\Kendo\UI\Filter
Parameters
$value string|\Kendo\JavaScriptFunction
Example - using string which defines a JavaScript function
<?php
$filter = new \Kendo\UI\Filter('Filter');
$filter->change('function(e) { }');
?>
Example - using string which defines a JavaScript name
<script>
function onChange(e) {
// handle the change event.
}
</script>
<?php
$filter = new \Kendo\UI\Filter('Filter');
$filter->change('onChange');
?>
Example - using \Kendo\JavaScriptFunction
<?php
$filter = new \Kendo\UI\Filter('Filter');
$filter->change(new \Kendo\JavaScriptFunction('function(e) { }'));
?>
expression
An object which represents a filter expression which the kendo.data.DataSource can use to filter the data.
Returns
\Kendo\UI\Filter
Parameters
$value ``
expressionPreview
If set to true the filter will visualize the filter expression that will be applied to the datasource.
Returns
\Kendo\UI\Filter
Parameters
$value boolean
Example
<?php
$filter = new \Kendo\UI\Filter('Filter');
$filter->expressionPreview(true);
?>
addField
Adds one or more FilterField to the Filter.
Returns
\Kendo\UI\Filter
Parameters
$value[, $value2, ...] \Kendo\UI\FilterField|array
Example - using \Kendo\UI\FilterField
<?php
$filter = new \Kendo\UI\Filter('Filter');
$field = new \Kendo\UI\FilterField();
$label = 'value';
$field->label($label);
$filter->addField($field);
?>
Example - using array
<?php
$filter = new \Kendo\UI\Filter('Filter');
$label = 'value';
$filter->addField(array('label' => $label));
?>
Example - adding more than one FilterField
<?php
$filter = new \Kendo\UI\Filter('Filter');
$first = new \Kendo\UI\FilterField();
$second = new \Kendo\UI\FilterField();
$filter->addField($first, $second);
?>
mainLogic
Defines the value of the logical operator at the root level of the filter expression.
Returns
\Kendo\UI\Filter
Parameters
$value string
Example
<?php
$filter = new \Kendo\UI\Filter('Filter');
$filter->mainLogic('value');
?>
messages
The text messages displayed in the filter. Use it to customize or localize the filter messages.
Returns
\Kendo\UI\Filter
Parameters
$value \Kendo\UI\FilterMessages|array
Example - using \Kendo\UI\FilterMessages
<?php
$filter = new \Kendo\UI\Filter('Filter');
$messages = new \Kendo\UI\FilterMessages();
$addExpression = 'value';
$messages->addExpression($addExpression);
$filter->messages($messages);
?>
Example - using array
<?php
$filter = new \Kendo\UI\Filter('Filter');
$addExpression = 'value';
$filter->messages(array('addExpression' => $addExpression));
?>
operators
The text of the filter operators displayed in the filter.
Returns
\Kendo\UI\Filter
Parameters
$value \Kendo\UI\FilterOperators|array
Example - using \Kendo\UI\FilterOperators
<?php
$filter = new \Kendo\UI\Filter('Filter');
$operators = new \Kendo\UI\FilterOperators();
$string = new \Kendo\UI\FilterOperatorsString();
$operators->string($string);
$filter->operators($operators);
?>
Example - using array
<?php
$filter = new \Kendo\UI\Filter('Filter');
$string = new \Kendo\UI\FilterOperatorsString();
$filter->operators(array('string' => $string));
?>