multiple filter conditions

4 posts, 1 answers
  1. Jan
    Jan avatar
    10 posts
    Member since:
    Nov 2011

    Posted 29 Aug 2012 Link to this post

    I can do something like
    // returns data where orderId is equal to 10248 or customerName starts with Paul
    filter: {
        logic: "or",
        filters: [
          { field: "orderId", operator: "eq", value: 10248 },
          { field: "customerName", operator: "startswith", value: "Paul" }
        ]
    }

    However, I am wondering... if it is possible to get filtering on condition like:
    orderID is equal to 10248 or
    ( customerName starts with "Paul" and customerLastName start with "B" ) ?

    Would you help me translate the conditions to filter: { ... } syntax?

    Thank you,




  2. Answer
    Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 30 Aug 2012 Link to this post

    Hello Jan,

    You can have multiple nested filter descriptors, for example: 

    dataSource.filter({
        logic: "or",
        filters: [
          { field: "fieldA", operator: "eq", value: 100 },
          {
             logic: "and",
             filters: [
                 { field: "fieldA", operator: "lt", value: 100 },
                 { field: "fieldB", operator: "eq", value: true }
             ]
         }
        ]
    });

    Regards,
    Rosen
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Diga
    Diga avatar
    4 posts
    Member since:
    May 2015

    Posted 15 May 2015 in reply to Rosen Link to this post

    For nested filter, does the implicit logic "and" apply? Or we need to specify it explicitly?
  5. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 15 May 2015 Link to this post

    Hello Diga,

    The logic operator is determined by the parent composite descriptor. It should be set explicitly.

    Regards,
    Rosen
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready