I could not find a way to do this, but as an alternative, you can do something like this.
Define the js variable with the expression you want and use it.
var condition = 'true'; $("document").ready(function(e) { if( condition) { var table = $("#example").DataTable( { "ajax": { "url": "", "type": "GET", "dataSrc": "" }, "columns": [ { "data": "customerFullName", "title": customerNameTitle }, { "data": "amount", "title": amountTitle }, { "data": "paymentDate", "title": paymentDateTitle }, { "data": "submissionDate", "title": submissionDateTitle }, ], "language": { "emptyTable": "", "url": "" } }); } else { var table = $("#example").DataTable( { "ajax": { "url": "", "type": "GET", "dataSrc": "" }, "columns": [ { "data": "customerFullName", "title": customerNameTitle }, { "data": "amount", "title": amountTitle }, { "data": "paymentDate", "title": paymentDateTitle }, { "data": "submissionDate", "title": submissionDateTitle }, ], "language": { "emptyTable": "" } }); } });
source share