aButtons conflicts with sscroll and sajaxsource
aButtons conflicts with sscroll and sajaxsource
michelkogan
Posts: 4Questions: 0Answers: 0
here is my code:
[code]editor = new $.fn.dataTable.Editor({
"ajaxUrl":"includes/content/json_data.php",
"domTable":".datatable",
"fields":[
{
"label":"Browser:",
"name":"browser"
},
{
"label":"Rendering engine:",
"name":"engine"
},
{
"label":"Platform:",
"name":"platform"
},
{
"label":"Version:",
"name":"version"
},
{
"label":"CSS grade:",
"name":"grade"
}
]
});
var e = $("#customersDataTable .datatable").dataTable({
bJQueryUI:!0,
bSortClasses:!1,
aaSorting:[
[0, "asc"]
],
bAutoWidth:!0,
bInfo:!0,
bScrollCollapse:false,
sPaginationType:"full_numbers",
bDestroy:true,
sScrollX: "101%",
fnInitComplete:
function(){
$("#customersDataTable .dataTables_length > label > select").uniform();
$("#customersDataTable .dataTables_filter input[type=text]").addClass("text");
$(".datatable").css("visibility","visible")}
,
"sDom": "Tfrti",
sAjaxSource:"includes/content/json_data.php",
aoColumns:[
{ "mDataProp":"browser" },
{ "mDataProp":"engine" },
{ "mDataProp":"platform" },
{ "mDataProp":"version", "sClass":"center" },
{ "mDataProp":"grade", "sClass":"center" }
],
oTableTools:{
"sRowSelect":"multi",
"aButtons":[
{ "sExtends":"editor_create", "editor":editor },
{ "sExtends":"editor_edit", "editor":editor },
{ "sExtends":"editor_remove", "editor":editor }
]
}
});
$(window).resize(function () {
e.fnAdjustColumnSizing();
})
[/code]
the problem is when i choose a row and click on edit button, an error pops out:
[quote]DataTables warning (table id = 'DataTables_Table_0'): Cannot reinitialise DataTable.
To retrieve the DataTables object for this table, pass no arguments or see the docs for bRetrieve and bDestroy[/quote]
I wanna know whats the problem ? When I remove sScrollX everything works perfect ! But I want to use it in my responsive design.
[code]editor = new $.fn.dataTable.Editor({
"ajaxUrl":"includes/content/json_data.php",
"domTable":".datatable",
"fields":[
{
"label":"Browser:",
"name":"browser"
},
{
"label":"Rendering engine:",
"name":"engine"
},
{
"label":"Platform:",
"name":"platform"
},
{
"label":"Version:",
"name":"version"
},
{
"label":"CSS grade:",
"name":"grade"
}
]
});
var e = $("#customersDataTable .datatable").dataTable({
bJQueryUI:!0,
bSortClasses:!1,
aaSorting:[
[0, "asc"]
],
bAutoWidth:!0,
bInfo:!0,
bScrollCollapse:false,
sPaginationType:"full_numbers",
bDestroy:true,
sScrollX: "101%",
fnInitComplete:
function(){
$("#customersDataTable .dataTables_length > label > select").uniform();
$("#customersDataTable .dataTables_filter input[type=text]").addClass("text");
$(".datatable").css("visibility","visible")}
,
"sDom": "Tfrti",
sAjaxSource:"includes/content/json_data.php",
aoColumns:[
{ "mDataProp":"browser" },
{ "mDataProp":"engine" },
{ "mDataProp":"platform" },
{ "mDataProp":"version", "sClass":"center" },
{ "mDataProp":"grade", "sClass":"center" }
],
oTableTools:{
"sRowSelect":"multi",
"aButtons":[
{ "sExtends":"editor_create", "editor":editor },
{ "sExtends":"editor_edit", "editor":editor },
{ "sExtends":"editor_remove", "editor":editor }
]
}
});
$(window).resize(function () {
e.fnAdjustColumnSizing();
})
[/code]
the problem is when i choose a row and click on edit button, an error pops out:
[quote]DataTables warning (table id = 'DataTables_Table_0'): Cannot reinitialise DataTable.
To retrieve the DataTables object for this table, pass no arguments or see the docs for bRetrieve and bDestroy[/quote]
I wanna know whats the problem ? When I remove sScrollX everything works perfect ! But I want to use it in my responsive design.
This discussion has been closed.
Replies
One thing to remember is that when DataTables uses scrolling, it will split the table into two elements, so if you call $('table').dataTable({...}) twice it will fail. The fnTables API method is one of the best ways of dealing with this, but I think we'd need a link to your page to actually see what is needed.
Allan
[code]
var editor;
function MyCustomersDataTables() {
if ($(".datatable").length > 0 && $.fn.dataTable) {
var tables = $.fn.dataTable.fnTables(true);
editor = new $.fn.dataTable.Editor({
"ajaxUrl":"php/json_data.php",
"domTable":".datatable",
"fields":[
{
"label":"Browser:",
"name":"browser"
},
{
"label":"Rendering engine:",
"name":"engine"
},
{
"label":"Platform:",
"name":"platform"
},
{
"label":"Version:",
"name":"version"
},
{
"label":"CSS grade:",
"name":"grade"
}
]
});
var e = $("#customersDataTable .datatable").dataTable({
bJQueryUI:!0,
bSortClasses:!1,
aaSorting:[
[0, "asc"]
],
bAutoWidth:!0,
bInfo:!0,
sScrollX:"101%",
bScrollCollapse:false,
sPaginationType:"full_numbers",
bDestroy:true,
fnInitComplete:
function(){
$("#customersDataTable .dataTables_length > label > select").uniform();
$("#customersDataTable .dataTables_filter input[type=text]").addClass("text");
$(".datatable").css("visibility","visible")}
,
"sDom": "Tfrti",
sAjaxSource:"php/json_data.php",
aoColumns:[
{ "mDataProp":"browser" },
{ "mDataProp":"engine" },
{ "mDataProp":"platform" },
{ "mDataProp":"version", "sClass":"center" },
{ "mDataProp":"grade", "sClass":"center" }
],
oTableTools:{
"sRowSelect":"multi",
"aButtons":[
{ "sExtends":"editor_create", "editor":editor },
{ "sExtends":"editor_edit", "editor":editor },
{ "sExtends":"editor_remove", "editor":editor }
]
}
});
$(window).resize(function () {
e.fnAdjustColumnSizing();
})
}
}
Test 1
Test 2
Test 3
Test 4
Test 5
jQuery(function($) {
MyCustomersDataTables()
});
[/code]
the error appears when you select one row and click on edit button
... instead of