Extra sort wrapper added everytime on reinitialization
Extra sort wrapper added everytime on reinitialization
Hi, I am having some trouble with reinitializing a dataTable. I have an event handle that open a dialog on click which contains a dataTable. I initialize the table like this
[code]
var oDataTable = $(this).dataTable(
{
"bJQueryUI": true,
"bFilter": true,
"bAutoWidth": false,
"bDestroy": true,
"sPaginationType": "full_numbers",
"aaSorting": [[1, 'asc']], //Default sorting on email / username
"oLanguage":
{
"sZeroRecords": "Add some courses to your planner"
},
"aoColumns":
[
{"bSortable": false, "bSearchable": false }, // Permission Id
{"bSortable": true, "bSearchable": true }, // email / username
{"bSortable": false, "bSearchable": false }, // view permission
{"bSortable": false, "bSearchable": false }, // edit permission
{"bSortable": false, "bSearchable": false }, // delete permission
{"bSortable": false, "bSearchable": false } // delete row
],
"fnInitComplete": function ()
{
$(this).show();
}
[/code]
I use bDestroy to handle reinitializing the table everytime a user opens the dialog. The problem I am having is if the dialog is opened more than one time the table styling gets messed up.
In the code I noticed that it is adding an extra sort wrapper in the headers as well.
This is what is looks like on the first click (working)
[code]
Email
[/code]
This is what is looks like if I open and close the dialog containing the dataTable three times. Notice how it keeps adding DataTables_srot_wrapper. Adds a new one each time you open and close it.
[code]
Email
[/code]
[code]
var oDataTable = $(this).dataTable(
{
"bJQueryUI": true,
"bFilter": true,
"bAutoWidth": false,
"bDestroy": true,
"sPaginationType": "full_numbers",
"aaSorting": [[1, 'asc']], //Default sorting on email / username
"oLanguage":
{
"sZeroRecords": "Add some courses to your planner"
},
"aoColumns":
[
{"bSortable": false, "bSearchable": false }, // Permission Id
{"bSortable": true, "bSearchable": true }, // email / username
{"bSortable": false, "bSearchable": false }, // view permission
{"bSortable": false, "bSearchable": false }, // edit permission
{"bSortable": false, "bSearchable": false }, // delete permission
{"bSortable": false, "bSearchable": false } // delete row
],
"fnInitComplete": function ()
{
$(this).show();
}
[/code]
I use bDestroy to handle reinitializing the table everytime a user opens the dialog. The problem I am having is if the dialog is opened more than one time the table styling gets messed up.
In the code I noticed that it is adding an extra sort wrapper in the headers as well.
This is what is looks like on the first click (working)
[code]
[/code]
This is what is looks like if I open and close the dialog containing the dataTable three times. Notice how it keeps adding DataTables_srot_wrapper. Adds a new one each time you open and close it.
[code]
[/code]
This discussion has been closed.
Replies
Allan