I am using the datatables jquery plugin. I am trying to use it as a shared function so that I can call a datatable from numerous pages without putting a huge amount of code on each page.
So I am trying to make a variable for the columns that get passed to the datatables function:
var columnsObj = {"columns": [
{"sName": "first_name","sTitle": "First Name","bSearchable": "true"},
{"sName": "last_name","sTitle": "Last Name","bSearchable": "true"},
{"sName": "email","sTitle": "Email","bSearchable": "true"}
]};
How would I take the above code and place that into the datatables function below properly?
Do i need to loop over the object? Or can I just include it somehow like below?
oTable = $("table.datatable").dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "getjson.cfc?method=tableData",
"aoColumns": [columnsObj]
});