'Columns' settings using html data attributes

'Columns' settings using html data attributes

BjornHoorelbekeBjornHoorelbeke Posts: 2Questions: 1Answers: 0

Hi all,

I'm using the new html data attributes feature to pass the settings of a datatable.

<table data-columns="[{'visible':false,'orderable':false,'searchable':false},{'type':'string','visible':true,'orderable':false,'searchable':true,'title':''},{'type':'string','visible':true,'orderable':true,'searchable':true,'title':'Date*'},{'type':'string','visible':true,'orderable':true,'searchable':true,'title':'Name*'},{'type':'string','visible':true,'orderable':true,'searchable':true,'title':'xxxID*'},{'type':'string','visible':true,'orderable':true,'searchable':true,'title':'yyyID*'},{'type':'string','visible':true,'orderable':true,'searchable':true,'title':'Project*'},{'type':'string','visible':true,'orderable':true,'searchable':true,'title':'Progress*'},{'type':'string','visible':true,'orderable':true,'searchable':true,'title':'Taal*'},{'type':'string','visible':true,'orderable':true,'searchable':true,'title':'Special needs*'},{'type':'string','visible':true,'orderable':true,'searchable':true,'title':'Finished*'}]" data-order="[[3, 'asc']]" id="DashboardGrid">

...

</table>

But this results in the following jquery error : "Uncaught TypeError: Cannot use 'in' operator to search for 'length' in ["

When I put the exact contents of the "data-columns" attribute in the initialisation using script everything works fine, so there is nothing wrong with the array but with parsing it from the attribute

Below my debug info

http://debug.datatables.net/eduyim

Any help please__

This discussion has been closed.