When I query a large amount of data with datatables, no display
When I query a large amount of data with datatables, no display
feng xia
Posts: 9Questions: 3Answers: 0
When I query a large amount of data with datatables,no display
function query_stock() {
$("#Button_stock").click(function () {
$.ajax({
url: '/querydata',
type: 'POST',
data: {
csrfmiddlewaretoken: $('[name=csrfmiddlewaretoken]').val(),
},
success: function (res) {
console.log(res)
$("#myTable2").DataTable().clear();
$("#myTable2").DataTable().rows.add(res.data).draw();
}
});
})
}
The data is around 7000 items
No problem when querying 300 data items
You can see the returned data from the network in chrome developer mode,console no display
This discussion has been closed.
Replies
That's an odd way to go. It would be better to use
ajax.reload()
rather than adding all the rows through the API.If that doesn't help, we're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
Thank you very much, but your method doesn't work.
The main thing is that I can't find the bug, I tried another identical API and had no problem querying 100,000 entries.
Attached is the initialization function
Colin asked for a test case
https://datatables.net/manual/tech-notes/10
in accordance with the forum rules.
Otherwise you have not supplied sufficient detail.