I am using the DataTable to display the results of a query built by the user. Each query will contain different columns and data. The query results are returned to the page in JSON format with extra metadata. I have built a JQuery function that parses the JSON in order to process the metadata and build two arrays: one with the new column set and one with the new data.
Column Set Format:
dataTitles = [ { "title": "Message" } ];
Data Set Format:
dataSet = [ ['There are no results'] ];
There are commas between each Column and each Data value.
This is how I process the arrays:
$( "#example" ).dataTable({
columns: dataResult[0],
data: dataResult[1],
destroy: true,
empty: true
});
dataResult[0] and dataResult[1] are JQuery arrays built in exactly the same form as shown above.
This produces an error detected in the console while in debug mode (F12):
SCRIPT5007: Invalid operand to 'in': Object expected
jquery.dataTables.min.js, line 4 character 306