Buttons in 2 rows, near the "search"

Buttons in 2 rows, near the "search"

g770913g770913 Posts: 2Questions: 0Answers: 0
edited August 2013 in DataTables 1.9
Hello.
I wanted to ask: is it possible to create 2 rows of buttons?
I have "csv" and "copy" buttons, and have added a "clear filter" button.
I would like the "csv","copy" to be in one row (just abouve the "search" box as it is now), and the clear filter button to be to the right of the filter text box.
Is that possible?

[code]
oTable = $('#tests').dataTable( {
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "js/swf/copy_csv_xls_pdf.swf",
"aButtons": [ "copy", "csv",
{"sExtends":"text",
sButtonText: "Clear Filters",
"fnClick": function ( nButton, oConfig, oFlash ) {
oTable.fnFilterClear();
$("select").val("");
$("input[class='text_filter']").val('');
}
}
]
}
..
[/code]
Thanks!

Replies

  • allanallan Posts: 63,381Questions: 1Answers: 10,449 Site admin
    You can use multiple instances of TableTools by initialising it with the 'new' keyword, rather than by using sDom (where you can only have once instance). Example here: http://datatables.net/release-datatables/extras/TableTools/alt_init.html .

    That way you could have one for your copy / csv buttons and one for the filter clear button which you can put wherever your want!

    Allan
  • g770913g770913 Posts: 2Questions: 0Answers: 0
    Thanks, works like a charm!
  • allanallan Posts: 63,381Questions: 1Answers: 10,449 Site admin
    Excellent - good to hear :-)

    Allan
This discussion has been closed.