Cast a javascript var to an existing datatable
Cast a javascript var to an existing datatable
If I don't have a reference to an existing jQuery datatable, how can i get one? i.e. how can I cast a javascript variable to an existing datatable so I can call datatable functions upon it?
I want to do this:
var mytable=(dataTable)$("#mytableid");
mytable.fnGetNodes().serialize();
The following doesn't work:
var mydata= $("#mytableid").fnGetNodes().serialize();
presumably because jQuery doesn't realise I am operating against a datatable. To be clear, I know the id of the table, but I don't have a reference to it. Thanks.
I want to do this:
var mytable=(dataTable)$("#mytableid");
mytable.fnGetNodes().serialize();
The following doesn't work:
var mydata= $("#mytableid").fnGetNodes().serialize();
presumably because jQuery doesn't realise I am operating against a datatable. To be clear, I know the id of the table, but I don't have a reference to it. Thanks.
This discussion has been closed.
Replies
I have the exact same problem, where you able to find a solution?
or
var OTable = $("#mytableid").dataTable();
//You now have the table
var serializedData = OTable.fnGetNodes.serialize();