Complex Filtering With Rad Grid (Client-Side)

2 posts, 0 answers
  1. Mark
    Mark avatar
    7 posts
    Member since:
    Apr 2013

    Posted 13 Mar 2014 Link to this post

    I have a RadGrid with client-side binding similar to the "ODataDataSource - Filtering, Sorting and Paging with RadGrid" example.  I have been able to add multiple filter conditions in the past by calling args.set_filterExpressions(filter); multiple times in the "requesting" function (see scripts.js in the example).  However, now I have a specification where I need to search multiple fields for a value (in addition to the other filters on the grid).  So the value might appear in column1,  column2, or column3.  An example of this kind of complex filtering is shown in the list view client-side filtering example

    What is the recommended way for a client-side bound RadGrid to have complex filtering expressions?  When calling args.set_filterExpressions(filter), any previous expression uses "AND" logic with the existing expressions.  My resulting filter would be an OData URL as in the list view OData filtering example:
    ((UnitPrice gt 25 and UnitsInStock lt 40) or (Discontinued ne true and startswith(ProductName,'I') eq true))

  2. Radoslav
    Radoslav avatar
    1566 posts

    Posted 18 Mar 2014 Link to this post

    Hi Mark,

    To achieve the desired functionality you can try modifying directly the $filter parameter in RadODataDataSource’s Requesting event:
    <script type="text/javascript">
        function onRequesting(sender, args) {
            args.get_options().data.$filter = "((UnitPrice gt 25 and UnitsInStock lt 40) or (Discontinued ne true and startswith(ProductName,'I') eq true))";
    <telerik:RadODataDataSource runat="server" ID="RadODataDataSource1">
        <ClientEvents Requesting="onRequesting" />
    In that way you can build or concatenate complex filter expression and pass it to the $filter parameter. Also you can get formatted grid’s filter expression by using following code snippet:
    var filterExpressions =

    I hope this helps.


    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

Back to Top