How to reload the table with the same data array var after data array var has been changed
How to reload the table with the same data array var after data array var has been changed
DolanTheMFMSWizard
Posts: 4Questions: 4Answers: 0
so I have
var groupsTable = $('#groups-table').DataTable({
"paging": false,
"ordering": true,
"searching": true,
"info": false,
"scrollY": 300,
"columnDefs": [
{ "orderable": false, "targets": 4 },
{ "searchable": false, "targets": 4 }
],
"deferRender": true,
"data": createGroupData(),
"columns": [
{ data: "Name", className: "font-weight-normal" },
{ data: "Owned" },
{ data: "Total" },
{ data: "OwnedSum" },
{ data: "Name", render: function (data) { return editTemplate.render(data); } },
{ data: null, className: "hidden-column" },
{ data: null, className: "hidden-column" }
]
}).draw();
and I want to reload this table with the same createGroupData() function when that function is called. So something like groupsTable.reload(). Any suggestions? I tried groupsTable.clear().rows.add(createGroupData()), but it complains cause I have custom columns.
This discussion has been closed.
Answers
What error do you get?
What does the function
createGroupData()
return - can you show a snippet? Is it different data than when"data": createGroupData(),
is used for initialization?You will also need to use
draw()
to show the updated table after your rows.add().Kevin