TypeError: this.s is null when recreating datatable

TypeError: this.s is null when recreating datatable

sathishkumar1sathishkumar1 Posts: 11Questions: 4Answers: 0

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

  • allanallan Posts: 61,669Questions: 1Answers: 10,096 Site admin

    Could you give a link to the page showing the issue please? Are you using the latest versions of both DataTables and ColReorder?

    Allan

  • sathishkumar1sathishkumar1 Posts: 11Questions: 4Answers: 0

    thanks for reply allan :)
    yes iam using latest version
    here it is my jsfiddle http://live.datatables.net/soyahata/3/edit

  • allanallan Posts: 61,669Questions: 1Answers: 10,096 Site admin

    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

  • sathishkumar1sathishkumar1 Posts: 11Questions: 4Answers: 0

    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.

  • allanallan Posts: 61,669Questions: 1Answers: 10,096 Site admin

    "the all column"

    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

  • sathishkumar1sathishkumar1 Posts: 11Questions: 4Answers: 0
    edited January 2018

    Click button and then try to reorder the columns(name and position) you will get error

  • allanallan Posts: 61,669Questions: 1Answers: 10,096 Site admin
    Answer ✓

    Got it! Thanks!

    Fix committed here. The nightly version will rebuild in the next 5 to 10 minutes with the change included.

    Allan

  • sathishkumar1sathishkumar1 Posts: 11Questions: 4Answers: 0

    thanks allan.

This discussion has been closed.