filter many columns on button click

filter many columns on button click

krongobkrongob Posts: 5Questions: 0Answers: 0
edited October 2009 in General
First thanks a lot for this great package.
Second, I have 4 columns, and I prepared a form with 4 text inputs and one button, I want the filtering to start when the button clicked. I searched the forum, I couldn't find anything confirm or deny the possibility of this.
You help is really appreciated n0n

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi krongob,

    1. :-) Thanks.

    2. All you need to do is have the fnFilter() API function triggered on the 'click' event (i.e. your click event handler will call fnFilter() with whatever values you need for it). The following two links might help:

    http://localhost/datatables/dataTables-1.5/examples/api/multi_filter.html
    http://datatables.net/api#fnFilter

    Regards,
    Allan
  • krongobkrongob Posts: 5Questions: 0Answers: 0
    thanks allan for the reply,
    This is how I did filtering:
    [code]
    $("#ButtonFilter").click(function() {
    oTable.fnFilter( $("#input1").val(), '0' );
    oTable.fnFilter( $("#input2").val(), '2' );
    oTable.fnFilter( $("#input3").val(), '4' );

    });
    [/code]
    This way filtering won't cause load on my ajax script that used to load table data from database. only when user specify all his filtering criteria and click the button to start filtering.

    Thanks again ;)
This discussion has been closed.