datatables: how to repopulate table after data changed? -
my goal repopulate/redraw/refresh table after aadata:'data' changed:
$(tableid).datatable({ "aadata": data, "destroy": true, "aocolumns": columns });
i suceed tricky:
$(tableid).datatable().fncleartable(); $(tableid).datatable().fndestroy(); $(tableid).datatable({ "aadata": data, "destroy": true, "aocolumns": columns });
which looks horrible. guess there must cleaner way ?
i've had struggle datatables also.
my solution:
var data = [json loaded ajax]
function loadtable(data){ if($.fn.datatable.isdatatable('#testslisttable')){ if(data.testrunreports.length == 0) $('#testslisttable').datatable().fncleartable(); else $('#testslisttable').datatable().fnadddata(data); return; } $('#testslisttable').datatable({ data: data, ...
Comments
Post a Comment