[Solved]Column Filtering Problem

[Solved]Column Filtering Problem

anjibmananjibman Posts: 115Questions: 10Answers: 0
edited November 2011 in General
Hi,

I implemented http://datatables.net/examples/api/multi_filter_select.html in my application but not working in my case where we have two values "Non-System" and "System".

When I select "Non-System" it works fine and shows only Non-System.
When I select "System" it shows all.
Is there any configuration i have to do for such search?

Thanks,
Anjib

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    edited November 2011
    probably because the text "Non-System" contains the text "System" so filtering by "System" that matches both values.

    You can use regular expression matching and force it to match the beginning and/or ending of the line with anchors ^ and $, respectively

    [code]oTable.fnFilter('^System', colNum, true); // use anchor to match only beginning of line containing system[/code]

    http://www.datatables.net/ref#fnFilter

    ----------------------------------
    in the script on that example page, replace near the bottom:

    [code]
    $('select', this).change( function () {
    oTable.fnFilter( "^" + $(this).val(), i, true ); // use reg exp matching and anchor
    } );[/code]
This discussion has been closed.