I always get error when I use table.ajax.reload()
I always get error when I use table.ajax.reload()
pig800509
Posts: 12Questions: 2Answers: 0
in DataTables
TypeError: e.abort is not a function
Sb
http://localhost:3000/js/jquery.dataTables.min.js:107:208
s.<anonymous>
http://localhost:3000/js/jquery.dataTables.min.js:108:45
s.iterator
http://localhost:3000/js/jquery.dataTables.min.js:99:243
s.<anonymous>
http://localhost:3000/js/jquery.dataTables.min.js:108:16
reload
http://localhost:3000/js/jquery.dataTables.min.js:102:110
This discussion has been closed.
Replies
var table = window.createDataTable("#example",{
dom: "Bfrtip",
ajax: async function (data, callback, settings) {
callback(
{"data":await invokeApig({ path: "/notes" })}
);
console.log(await invokeApig({ path: "/notes" }));
},
columns: [
{ data: "noteId"},
{ data: "userId" },
{ data: "attachment" },
{ data: "content" },
{ data: "createdAt" }
],
select: true,
buttons: [
{ extend: "create", editor: editor },
{ extend: "edit", editor: editor },
{ extend: "remove", editor: editor },
{
text: 'Reload table',
action: function () {
table.ajax.reload();
}
}
]
});
DataTables doesn't expect a Promise to be returned from that function. You need to use the callback once your
invokeApig
method has executed (e.g. use an internal Promise there or have it provide a callback option).Allan