Telerik UI for Windows 8 HTML

Filtering is initially done by calling the filter(propertyName, operator, value) method. The method receives three arguments:

  • propertyName: The name of the field (table column) that you want to filter by.

  • operator: The filter operator. Accepted values are are <, <=, >, >=, =, ==, !=, and <>.

  • value: The value to filter by.

To apply the filter, call the execute() method.

Here you can see an example that applies a single filter to the data retrieved from a Sales table in a SalesDB database.

Apply Single Filter Expression Copy imageCopy
db = Telerik.Data.Database.open("SalesDB");
db.get("Sales")
    .filter("name", "like", "R%")
    .execute().then(querySuccess);

The above example will produce the same result as calling the query method with the following SQL expression:

SQL Copy imageCopy
SELECT * FROM Sales WHERE name LIKE 'R%'

To apply multiple filter expressions, use the and(propertyName, operator, value) and or(propertyName, operator, value) methods after the initial filtering applied through the filter(propertyName, operator, value) method. As their names suggest, and(propertyName, operator, value) adds a filter expression using the AND logical operator while or(propertyName, operator, value) adds a filter expression using the OR logical operator.

Here is an example of two filter expressions chaining. You can see that the execute() method is called at the end. This method triggers the entire chain of expressions.

Apply Multiple Filter Expressions Copy imageCopy
db.get("Sales")
    .filter("name", "like", "R%")
    .and("bonus", ">", 100)
    .execute().then(querySuccess);

The above example will produce the same result as calling the query method with the following SQL expression:

SQL Copy imageCopy
SELECT * FROM Sales WHERE name LIKE 'R%' AND bonus  > 100

See Also