1

I want to filter all columns in the data grid based on or condition. For a single column(name) filter I tried below function and it's working properly.

grid.filter( {name: "*" + value + "*" } );

Now I want to use this filter for multiple columns on grid, I tried below code but that is not working:

grid.filter({name:"*" + value + "*"} || {solution:"*" + value + "*"});

Please help me with suitable code for multiple column filter on grid. I am using Dojo 1.8.1.

VMai
  • 10,156
  • 9
  • 25
  • 34
Swpno
  • 173
  • 1
  • 13

2 Answers2

0

Create hidden column for filtering purposes and put in concatenated data you want to be filtered.

If your data for datastore are:

data=[
{ name: "smartphone", solution: "use iPhone instead iPod"},
{ name: "tablet",     solution: "use iPad instead iPod"},
{ name: "iPad",       solution: "use it"}
]

add column forFiltering with concatenated data of other columns:

data=[
{ name: "smartphone", solution: "use iPhone instead iPod", forFiltering: "smartphone use iPhone instead iPod"},
{ name: "tablet",     solution: "use iPad instead iPod",   forFiltering: "tablet use iPad instead iPod"},
{ name: "iPad",       solution: "use it",                  forFiltering: "iPad use it"}
]

and then do filtering on that column:

grid.filter({forFiltering:"*" + value + "*"});
0

IF I understand your question correctly, you can simply separate the two arguments for the filter with a comma. so instead of grid.filter({name:"*" + value + "*"} || {solution:"*" + value + "*"});

you should use grid.filter({name:"*" + value + "*",solution:"*" + value + "*"} );

you can check this working example in jsfiddle

dori naji
  • 980
  • 1
  • 16
  • 41