Column Filtering w/Checkboxes

Column Filtering w/Checkboxes

SABmoreSABmore Posts: 5Questions: 0Answers: 0
edited August 2011 in Plug-ins
Are there posted examples of using checkboxes to filter columns? And can these be positioned outside of the ? In other words, I have Event Types, which contain values such as: Sports, Concerts, Plays. I want to create a checkbox group, where a user can select 1->N checkboxes and have it filter the results. The checkboxes would be to the side of the results table. Any advice is appreciated. Thanks!


  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    I don't think there are posted examples of this, but this is possible.

    If you're using client side code, you can compose a reg ex filter of the checkbox values, pass it to fnFilter. see

    var oTable;

    $(document).ready(function() {
    oTable = $('#example').dataTable();

    /* example of Filter on oTable*/
    oTable.fnFilter('sports|concerts', col_number, regexp = true );
    } );

    if you're using server side processing, you can send special parameters to the server script and compose a WHERE clause using OR.
  • goldnetgoldnet Posts: 8Questions: 0Answers: 0
    Hi, i have the same problem tring to filter table with checkbox but i dont understand your example;
    can you explain it better;
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    @goldnet: the above example will work with client-side processing, where regexp (regular expressions) is natively supported. you can get it to work on server-side processing if you make some minor alterations to the server_processing.php (and if you're using a database system like MySQL that supports REGEXP operator).

    in regular expression language, the "|" character means "OR", so the above filter looks for values that are either 'sports' OR 'concerts'.
This discussion has been closed.