Change on calling .Datatables([]) repeatedly after .clear(),destroy()

Change on calling .Datatables([]) repeatedly after .clear(),destroy()

leolikesbassleolikesbass Posts: 1Questions: 1Answers: 0

I call this repeatedly, and this application has been working fine until yesterday(I get the nightly builds). Everything changed yesterday.

table= $("#openTicketList").DataTable({
"createdRow": function( row, data, dataIndex){

        if( data["Assigned"] ==  `N`){

            $(row).addClass('gridUnassigned');
        }

    },
    "fnDrawCallback": function (oSettings) {
        alert("callback funcion");
    },
      select: true,
    "dom": 'T<"clear">lfrtip',
    "ajax": {url:'jsps/ajaxData/Factrak/getOpenTix.jsp?srv_dept='+ $( "#srvDeptSelect").val(),dataSrc:""},


        select: true,
        "order": [[ 1, "desc" ]],
        "aoColumns": [
            { "mData": "Ticket ID"},
            { "mData": "Ticket Number"},
            { "mData": "Activity"},
            { "mData": "Priority"},
            { "mData": "Date Rcv"},
            { "mData": "Location"},
            { "mData": "Requestor"},
            { "mData": "Req phone"},
            { "mData": "Assigned"},
            { "mData": "Serv dept"},
            { "mData": "Date Req"}

        ],
        "columnDefs": [
            {
                "targets": [ 0, 10 ],
                "visible": false,
                "searchable": false
            }
        ]
       });

When I am about to reload this, I call table.clear.destroy(). I have replaced it with the .url().load(), but just a note ab out what happened.

Answers

  • kthorngrenkthorngren Posts: 20,141Questions: 26Answers: 4,735

    Everything changed yesterday.

    Please provide more details of the problem. What errors do you get, etc?

    Kevin

  • vindeshvindesh Posts: 1Questions: 0Answers: 0
    edited May 2022

    Getting error when i destroy table object
    table.clear().destroy();

          $(tableId +' thead tr').remove();
    
          $(tableId + ' tbody').empty();
          $(tableId + ' thead').empty();
    

    Getting error:
    datatables.min.js:88 Uncaught TypeError: Cannot read property 'style' of undefined
    at Za (datatables.min.js:88)

    Please provide any solution ?

  • kthorngrenkthorngren Posts: 20,141Questions: 26Answers: 4,735

    $(tableId + ' thead').empty();

    Are you building a new header? If not then you columns.title to have Datatables build the header or don't remove it.

    If you still need help the please provide a link to your page or a test case replicating the issue.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

Sign In or Register to comment.