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

OR filtering

1 Answer 95 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 25 Jan 2012, 07:28 PM
Hi All,

I cannot figure out how to do "OR" filtering.  It seems that the filtering is currently done using "AND" logic:

For Example:
var filter = [{ field: "name", operator: "contains", value: "mark"},
          { field: "title", operator: "contains", value: "mr."}];

This filter will find all records with a name containing "mark" AND a title containing "mr.".  Is there a way to filter the records with a name containing "mark" OR a title containing "mr."?

Thanks in advance for any help!

1 Answer, 1 is accepted

Sort by
0
Accepted
Andrew
Top achievements
Rank 1
answered on 26 Jan 2012, 03:10 PM
The filter has a logic property:
...
filter.logic: "or",  /* use "and" or "or"...
...

Longer example:

dataSource.filter({
logic: "or",
filters: [
{field: "somefld", operator: "ne", value: "fee"},
{field: "somefld", operator: "ne", value: "fi"}
]
});

Tags
Data Source
Asked by
Matt
Top achievements
Rank 1
Answers by
Andrew
Top achievements
Rank 1
Share this question
or