Undesired TableTools buttons for DataTables in Accordion panes with index > 0
Undesired TableTools buttons for DataTables in Accordion panes with index > 0
robertbrower
Posts: 158Questions: 1Answers: 0
I've got an accordion with 4 panels. Each panel contains a DataTable. This is done in this way:
[code]
settings.$accordion = $this.find("#Accordion").accordion({
fillSpace: true
, change: function (event, ui) {
$($.fn.dataTable.fnTables(true)).each(function (i, table) {
if ($.contains(ui, table)) {
var $dataTable = $(table).dataTable();
$.layout.callbacks.resizePaneDataTables($dataTable, $(ui));
}
});
}
});
settings.$accordionDataTables = settings.$accordion.find("table.display").dataTable({
"bJQueryUI": true
, "sDom": '<"H"lTfr>t<"F"ip>'
, "oTableTools": {
"sSwfPath": urls.MediaUrl + "Scripts/DataTables-1.9.1/extras/TableTools/media/swf/copy_csv_xls_pdf.swf"
, "aButtons": [
{
"sExtends": "csv"
}
]
}
, "iDisplayLength": 10
, "sPaginationType": "full_numbers"
, "sScrollY": "0px"
});
[/code]
The CSV button appears in the top (visible) panel's datatable. But in the datatables that are in panels below the first, all of the tabletools buttons appear when instead only the CSV button should appear.
The part of $.layout.callbacks.resizePaneDataTables() that resizes the buttons looks like this:
[code]
// TableTools
if (typeof(TableTools) != "undefined") {
var tableTools = TableTools.fnGetInstance(table);
if (tableTools != null && tableTools.fnResizeRequired()) {
tableTools.fnResizeButtons();
}
}
//
[/code]
fnResizeRequired() is always returning false. Does anyone know why? Great plugin. Thanks!
[code]
settings.$accordion = $this.find("#Accordion").accordion({
fillSpace: true
, change: function (event, ui) {
$($.fn.dataTable.fnTables(true)).each(function (i, table) {
if ($.contains(ui, table)) {
var $dataTable = $(table).dataTable();
$.layout.callbacks.resizePaneDataTables($dataTable, $(ui));
}
});
}
});
settings.$accordionDataTables = settings.$accordion.find("table.display").dataTable({
"bJQueryUI": true
, "sDom": '<"H"lTfr>t<"F"ip>'
, "oTableTools": {
"sSwfPath": urls.MediaUrl + "Scripts/DataTables-1.9.1/extras/TableTools/media/swf/copy_csv_xls_pdf.swf"
, "aButtons": [
{
"sExtends": "csv"
}
]
}
, "iDisplayLength": 10
, "sPaginationType": "full_numbers"
, "sScrollY": "0px"
});
[/code]
The CSV button appears in the top (visible) panel's datatable. But in the datatables that are in panels below the first, all of the tabletools buttons appear when instead only the CSV button should appear.
The part of $.layout.callbacks.resizePaneDataTables() that resizes the buttons looks like this:
[code]
// TableTools
if (typeof(TableTools) != "undefined") {
var tableTools = TableTools.fnGetInstance(table);
if (tableTools != null && tableTools.fnResizeRequired()) {
tableTools.fnResizeButtons();
}
}
//
[/code]
fnResizeRequired() is always returning false. Does anyone know why? Great plugin. Thanks!
This discussion has been closed.