Cannot reinitialise datatable

Cannot reinitialise datatable

sasank963sasank963 Posts: 2Questions: 1Answers: 0

Hi,

I have a function defined like below and I am trying to use the same function in another jsp file to make the modal stay in same page. But, I get the error. I am just calling the same function without declaring jQuery('#automap_err').DataTable() anywhere in the jsp again as it is already defined in the function in another js file. Please help

DataTables warning: table id=automap_err - Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3

function refreshTable()
{
try{
var _t = jQuery('#automap_err').DataTable();
_t.draw(false);
}catch(e){}
}

Answers

  • allanallan Posts: 63,839Questions: 1Answers: 10,518 Site admin

    Thanks for your question - however, per the forum rules can you link to a test case showing the issue please. This will allow the issue to be debugged. It sounds like it might be an execution order issue.

    Information on how to create a test page, if you can't provide a link to your own page can be found here.

    Thanks,
    Allan

  • sasank963sasank963 Posts: 2Questions: 1Answers: 0

    Allan,

    Thanks for the reply. Unfortunately I cannot post a test case but here my new issue. when I define variable table in my new jsp(as shown last) I am getting an error like "Uncaught TypeError: Cannot set property '_DT_CellIndex' of undefined". I don't know what this is about. Please let me know your input. The data table automap_err is defined as below

    <bs:bsDataTable defaultSort="asc" processing="true"
    tableId="automap_err" pagingType="numbers" dom='rtip'
    lengthMenu="[[5],[5]]"
    dsUrl="url"
    responsive="true" serverSide="true"
    tableClass="display table blbs_tbl cell-border font-data-label"
    defaultOrdColumn="1" tableWidth="96%"
    detailRowFormatter="customDetailedRowformatter" customUserParam="customDefUserParam">
    </bs:bsDataTable>

    This is what I am using in another jsp file. The jquery is unable to recognise the datatable automap_err is what I understood. Any input is appreciated.

    var table = jQuery("#automap_err").DataTable();
    alert("table: "+table);

    Thank you.

  • allanallan Posts: 63,839Questions: 1Answers: 10,518 Site admin

    I'm sorry to say there is very little help I can offer without a test case.

    All I can really say is that the error "Uncaught TypeError: Cannot set property '_DT_CellIndex' of undefined" can be caused by the number of columns in the table not matching the number defined in the Javascript.

    Allan

This discussion has been closed.