I have a dgrid populated with a dstore plain old Memory collection, that I am trying to filter using the 'contains' filter method. The store data looks something like this:
[
{id:"25", users: ["13", "15"]},
{id:"347", users: ["13"]},
{id:"653", "users":["13", "17"]}
]
I want to retrieve all the records where a given user is in the users array. From my understanding, I was expecting to be able to set up a filter like new Filter().contains('users', '15'); and set that as the collection for the grid, leaving one row (id = '25') in this example. However, I am left with 0 rows. I have also tried providing a regular expression for the filter, instead of just value matching, like new Filter().contains('users', new RegExp('^15$')); however this doesn't filter out any rows.
I am using dojo v1.10.4, dgrid v1.0.0 and dstore v1.1.1. Here is a JSFiddle demonstrating my problem.
Am I doing something wrong?
Thanks.
filtermethod for the store. - Himanshu