Exact Match Select Filter
Exact Match Select Filter
Hey all :-)
I'm using the Multi Filter Select (http://www.datatables.net/release-datatables/examples/api/multi_filter_select.html) and have some Problems with my Car Column. It contains a Chevrolet Impala SS and a Chevrolet Impala SS Class B. If i choose the Impala SS i get the Impala SS Class B as well. I just want to get the exact Match. I think it has to do with Smart filtering and read about it but my knowledge isn't the best.
You can see my Problem on this Page:
http://www.chogger.de/?p=track_laps&trackid=20
Thank You
I'm using the Multi Filter Select (http://www.datatables.net/release-datatables/examples/api/multi_filter_select.html) and have some Problems with my Car Column. It contains a Chevrolet Impala SS and a Chevrolet Impala SS Class B. If i choose the Impala SS i get the Impala SS Class B as well. I just want to get the exact Match. I think it has to do with Smart filtering and read about it but my knowledge isn't the best.
You can see my Problem on this Page:
http://www.chogger.de/?p=track_laps&trackid=20
Thank You
This discussion has been closed.
Replies
The fnFilter call in the select.change event of the example code can take an argument specifying regular expression matching, which is by default false.
[code]
$('select', this).change( function () {
oTable.fnFilter( "^"+$(this).val()+"$", i , true); // <--- add 3rd parameter "true" and add anchors
} );
[/code]
http://www.datatables.net/ref#fnFilter
Works perfect
in the example above "." means match any character. "*" means match 0-or-more of the preceding character (or set). so combined ".*" means match any string of characters; it's a catch-all for matching, so you see this all the time.
http://www.regular-expressions.info/reference.html
Thanks :)