Friday, November 4, 2011

Telerik MVC Grid: Client Side filtering

One of the nice features of the Telerik MVC Grid is filtering. What makes this even cooler is that you can easily add your own filters using the client side API.
An example:
$(function () {
    var button = $("#filterButton");

    var filtered = false; (e) {
        var grid = $("#ordersGrid").data('tGrid');

        if (filtered === false) {
            button.html('Remove filter');
            filtered = true;
   //Add filter
        else {
            button.html('Add filter');
            filtered = false;
   //Remove filter


Remark: Unfortunately this only seems to work when operationmode of the grid is not changed to GridOperationMode.Client.