Column data both client-side (1st page) and server side
Column data both client-side (1st page) and server side
Hi,
I have a table which is populated via HTML DOM (the first page is automatically loaded and builds the HTML table) and the following pages are retrieved via AJAX.
When I initialize the data, i'm setting the column definitions data to the column index. When I fetch a new page, I cannot use the index, because the data comes from JSON objects and the attributes have proper names (not 0, 1, etc. ). So, there's a conflict in the column definitions for the initialization and for the next pages.
Can I create the datatable based on the DOM table withouth using the index of the coluns and using already the correct attribute ?
I'm also not being able to set the data as a function (Requested unknown parameter {function}).
Thank you
Answers
To avoid this issue, I'm now building a JSON variable with the records from the first page (client-side), instead of building the HTML DOM. This way, both scenarios will use JSON variables and the columns data definition can be made exclusively by the object attributes' name.