Change tfoot position

Change tfoot position

RPDacosRPDacos Posts: 2Questions: 0Answers: 0
edited February 2012 in General
Hi there,
First point: great job guys!!!
Second point: I'm using DataTable and I need a specific search for each column. Nothing simpler!
I added a code found here on the bottom of jquery's document.ready, so...
[code]$(document).ready(function() {
[...]
$(document).on('keyup', 'tfoot input', function () {
/* Filter on the column (the index) of this element */
oTable.fnFilter( this.value, $("tfoot input").index(this) );
});
});
[/code]

i also added the tfoot with input fields where needed...
[code]
















[/code]

It is displayed correctly but it's on the bottom of the table and i need it on the top, before the thead.

Is it possible?
Any help is welcome!

Rick

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    There are a number of options, but the main point to make is that DataTables doesn't case where the filters are - as long as you call fnFilter. For example: http://datatables.net/release-datatables/examples/api/regex.html .

    So you could do something like in my example and position your inputs as needed. Or you could put them in the thead before your actual titles (make them TD elements), or put them anywhere else you want :-)

    Allan
  • RPDacosRPDacos Posts: 2Questions: 0Answers: 0
    I liked the idea to use the entire tfoot tag to include the search inputs but there is any matter to do that, so I use your second suggest and put a with element instead of on the tag in first position. Obviously it works perfectly!
    Thank you for the help :)

    R.
This discussion has been closed.