trigger the search

trigger the search

valdezrvaldezr Posts: 49Questions: 0Answers: 0
edited May 2009 in General
how can I trigger the search on an html object,
by example on the click of a button or on change of a select box? and not with the key press on the search box.

Something similar to what fnFilter function do, but I need just to invoke the search to make my own WHERE parameters in the query like 'is not null' or a sort of that.

Thanks in advance.

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    I think to some extent you've answered your own question here :-). You just use fnFilter with whatever search value you are looking for. For example on a select menu you could have:

    $('#whatever select').change( function() { oTable.fnFilter( $(this).val() ); } );.

    Does that help?
    Allan
  • kharr0kharr0 Posts: 4Questions: 0Answers: 0
    edited January 2010
    How do you get the reference to the DataTable (oTable)? Calling dataTable() causes the table to be reinitialized.

    Thanks,

    -k

    NEVERMIND - fixed it myself. Unfortunately, javascript isn't my cup of tea :-)
  • retsellretsell Posts: 2Questions: 1Answers: 0
    Why does: $('#orderstatus').change( function() { oTable.fnFilter( $(this).val() ); } );

    work, but:

    $('#orderstatus').change( function() { oTable.fnFilter( $(this).val(), 9 ); } );

    does not work once I want to limit the filter to column 9?

    Thanks in advance.
This discussion has been closed.