data() returning different things
data() returning different things
I have instantiated two DataTables "NewWorklistTable" and "ChooseWorklistTemplateTable" latter has one row of data.
Data is javascript sourced, element where they are instantiated are just empty table elements.
However when I try to get the data with "$("NewWorklist").DataTable().data();" it returns the datatables object.
Except when running that from chromes developer console.
In chrome console "console.log($("NewWorklist").DataTable().data());" also returns DataTables object from that element.
This behaviour happens with both datatables, first I thought something was wrong with NewWorklistTable but it
doesnt seem so. rows().data() behaves same way.
Am I doing something wrong or what could be the cause? I'm trying to get the data out the tables.
This question has an accepted answers - jump to answer
Answers
The
data()
method returns a DataTables API instance. UsetoArray()
to convert it to be just a plain array.Allan
Thank you!