PDA

View Full Version : [SOLVED] store.filter casesensitive



vorcigernix
3 Feb 2008, 1:37 PM
Hello,
another problem:
I have in my code:

var rgfilter = new RegExp(n+"*");
store.filter('gamertag',rgfilter,false,false);

but filter works casesensitive. What's wrong?

evant
3 Feb 2008, 1:51 PM
Pass the 'i' option to the regex (ignore case).



var rgfilter = new RegExp(n+"*", "i");

vorcigernix
3 Feb 2008, 11:19 PM
Heh..okay, thanks.
I thought that ignore case is what last false do. So its meant to use only without regex? I can live with that, but I can't catch logic behind, it still something what MS is used to call "feature" for me.

devnull
4 Feb 2008, 8:43 AM
The docs arent clear about this but this is what i would guess;
the filter can accept either a string or a regex object. when using a string, it likely constructs a regex internally, and the "caseSensitive" option is added based on what was passed. however if you construct your own regex i will ignore that since it cannot modify the passed in regex options. the same would be true of the "anyMatch" config option.