This is a migrated thread and some comments may be shown as answers.

Grid multiple values

2 Answers 273 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 21 Jul 2016, 09:43 AM

I have a grid and I am trying to filter on multiple values:
FirstName, LastName or FirstName + " " + LastName

So the user can search for:
"John"
"Smith"
"John Smith"

 

Currently I have:

grid.dataSource.filter({
    logic: "or",
    filters: [
        { field: "FirstName", operator: "contains", value: value },
        { field: "LastName", operator: "contains", value: value },
        { field: "MemberID", operator: "equals", value: value },
        { field: "JobTitle", operator: "contains", value: value },
 
            {
                logic: "and",
                filters: [
                    { field: "FirstName", operator: "equals", value: value },
                    { field: "LastName", operator: "equals", value: value }
                ]
            }
 
    ]
});

 

The search for "John" or "Smith" works however not on "John Smith"

Any ideas
Thanks

Tom

 

 

2 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 25 Jul 2016, 08:22 AM

Hello Tom,

In order to support such functionality you will need to split the value and create filter expressions which to filter on the individual values.

Another approach will be to use a custom filter function to concatenate the fields' value and  filter on the result.

Here is a basic implementation of both approaches. 

Regards,
Rosen
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
0
Tom
Top achievements
Rank 1
answered on 25 Jul 2016, 03:40 PM

Thanks Rosen for the example.

There is also a good example here: http://www.telerik.com/forums/grid-search-feature#hajM7dAms0KgZi2jeCl6eA 

For anyone else with this issue.

Tags
Grid
Asked by
Tom
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Tom
Top achievements
Rank 1
Share this question
or