And with Or filters on MVC Grid (client side)

2 posts, 0 answers
  1. Simon
    Simon avatar
    1 posts
    Member since:
    Oct 2016

    Posted 20 Jul 2017 Link to this post

    We currently filter some MVC grids on the client (this works well for us) however a new requirement is to filter on a value in ONE column, and if value appears in a set of other columns.

    E.G. 

    A + (B or C or D)

    current we filter like this on the "A" column 

    grid.dataSource.filter({
           logic: "or",
          filters: [
              { field: "SkillStatus", operator: "contains", value: "D" }
              ]
    });

    and this is how we filter on the B,C & D columns 

    grid.dataSource.filter({
                    logic: "or",
                    filters: [
                        { field: "SkillName", operator: "contains", value: val },
                        { field: "SkillCode", operator: "contains", value: val },
       
                    { field: "SkillDesc", operator: "contains", value: val },

                        ]
                });

    Is there a way to apply both these filters to one grid, such that 

    A   | B   | C    | D   |
    1   | X    | Y    | X   |
    1   | Y    | X    | X   |
    2   | Z    | Z    | Z   |
    2   | Y    | Y    | Z   |

    A = 1 , "Other Value" = X  returns
    A   | B   | C    | D   |

    1   | X    | Y    | X   |
    1   | Y    | X    | X   |

    A = 1 , "Other Value" = Z  returns
    A   | B   | C    | D   |

    (no records)

    A = 2 , "Other Value" = Z  returns

    A   | B   | C    | D   |
    2   | Z    | Z    | Z   |
    2   | Y    | Y    | Z   |

    A = 2 , "Other Value" = X  returns
    A   | B   | C    | D   |

    (no records)

  2. Georgi
    Admin
    Georgi avatar
    678 posts

    Posted 21 Jul 2017 Link to this post

    Hi Simon,

    I have assembled small sample which illustrates how to use And with Or filters client-side:



    Regards,
    Georgi
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top