Can i do a custom filtering?

Can i do a custom filtering?

fai1012fai1012 Posts: 2Questions: 0Answers: 0
edited June 2011 in General
In my situation, all data in the table are separated into three group.
there are three button outside the table.
when users click button A, only group A of data will be shown.
can i do it in datatable?

i am trying something like that, use a Temp var to store the original table,
after the user click the button, use fnDeleteRow to delete the row and use the Temp to restore the table later on. However, i have no idea how to find the wanted row to delete.

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    if your table is oTable, and you know the column number you want to filter on:

    [code]
    oTable.fnFilter(value, colnum);
    [/code]

    attach onclick events to your buttons, i.e. on "button_a":
    [code]

    var oTable = null;

    $(document).ready(function() {
    oTable = $('#example').dataTable( ); // change the name of the target table, if you need
    } );


    [/code]

    [code]



    [/code]

    and of course use the right id name for the table, and change the value="" values for your criteria. also remember that column indexes start at 0.
This discussion has been closed.