TypeError: this.s is null when recreating datatable
TypeError: this.s is null when recreating datatable
I created datatable with colreorder,in that datatable 2 column not visible and I added button for recreating datatable for making visible of 2 columns.My issue is i cant reorder the 2 visible columns(Name and position) after i click the button.
error:TypeError: this.s is null
anyone give solution for this?
$(document).ready( function () {
var table;
function sample(){
table = $('#example').dataTable( {
colReorder: true,
dom: 'frtip',
"aoColumnDefs": aoColumns,
} );
}
if(true){
aoColumns=[
{ sTitle: "Name","aTargets": [0],"bVisible":false},
{ sTitle: "Position","aTargets": [1],"bVisible":false},
{ sTitle: "Office","aTargets": [2]},
{ sTitle: "Age","aTargets": [3]},
{ sTitle: "Start date","aTargets": [4]},
{ sTitle: "Salary","aTargets": [5]},
]
sample();
}
$("button").click(function(){
table.fnDestroy();
aoColumns=[
{ sTitle: "Name","aTargets": [0]},
{ sTitle: "Position","aTargets": [1]},
{ sTitle: "Office","aTargets": [2]},
{ sTitle: "Age","aTargets": [3]},
{ sTitle: "Start date","aTargets": [4]},
{ sTitle: "Salary","aTargets": [5]},
]
sample();
});
This question has an accepted answers - jump to answer
Answers
Could you give a link to the page showing the issue please? Are you using the latest versions of both DataTables and ColReorder?
Allan
thanks for reply allan
yes iam using latest version
here it is my jsfiddle http://live.datatables.net/soyahata/3/edit
Thank you.
If I reorder the columns and then click the button, I don't see any error relating the to the message you noted above:
error:TypeError: this.s is null
. What steps do I need to take to reproduce the error?Allan
Thank you allan.
after clicking the button again i want to reorder the all column.if i try to reorder the column after button is clicked error is occur.
I'm afraid I don't understand what you mean by this. Could you give me a step by step process on how to reproduce the error please?
Allan
Click button and then try to reorder the columns(name and position) you will get error
Got it! Thanks!
Fix committed here. The nightly version will rebuild in the next 5 to 10 minutes with the change included.
Allan
thanks allan.