Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82136

Properties enclosed by quotes: how to fix this?

$
0
0
I'm using a framework to configure the properties for Datatables. I'm using PHP and Twig. I'm building an array, containing all data (such as aaData and aoColumnDefs) and configuration (sorting, columns, etc.). The problem I'm facing is that json_encode($config) returns the JSON representation of a value, enclosed by quotes.

DataTables expects a non-quotes value, but this is what my script returns:
$('#example').dataTable({"aoColumnDefs":[{"sType":"numeric","sWidth":"100px","aTargets":[4,5]});
My problem: 'aoColumnDefs' has to be enclosed by quotes, but 'sType' of 'sWidth' may not be enclosed by quotes.

How can I fix this?

Viewing all articles
Browse latest Browse all 82136

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>