Data Collection Filter FINDINSET

Hi,

I need a little more complicated filtering for a data collection.

When I use a multiselect and select several values, it is written comma-separated to the database, f.e. “val1, val2, val4” etc.

I want to filter a data collection to see f.e. where f.e. val4 is present.

Using the php-dataconnector it works by using
$grid->filter(“FIND_IN_SET(”.$_SESSION[“id”].", aufgabe_assignedto) OR FIND_IN_SET(".$_SESSION[“id”].", aufgabe_erteiltvon)");
But how does a filter “find in set” work for data collections using a code like
list.filter(function(obj){
return obj.text.toString().indexOf(“abc”) != -1;
});

Thank you for any help!
Martin

Hi,

filter method sets a function that is called for each data item. The function should return true or false value, but you can apply any check there.

var search = ["abc","def", ...];

function myFilter(obj){
    var text= obj.text.toString();
    for(var i =0; i < search.length; i++){
         if(text.indexOf(search[i]) != -1)
             return true;
    }
    return false;
}