I am using uptil now 3 datatables in jquery-ui tabs. i prefer to keep them all in background and really use 3 tables. The data comes via ajax in arrays of objects (is used in that format also by other presenters).
However, since the number and type of tables could change and should be kept easy to maintain.
The problem now is to elegently use the same constructor. Can I set the aoColumns as a parameter only and not also re-set it at runtime?
Right now, the Code looks like this:
tables=$(".dat").dataTable({
"bJQueryUI": true,
"bDeferRender": true,
"bPaginate": false,
"bProcessing": true,
"sAjaxSource": "ajaxdataA.json",
"ssAjaxDataProp" : "data",
"aoColumns": [{"mData": "col1"}, {"mData": "col2"},{"mData": "col3"}]
});
I would like to set that as an array and then use specifics for the sAjaxSource and aoDataColumns for the individual tables. It could of course also be achieved by storing the parameter object and extending it or using a factory closure. I also thought on using AngularJS instead.
Does anybody have a more elegant solution?