simple-datatables
simple-datatables copied to clipboard
Strange slow down
Thanks very much for this really straightforward and simple to use plugin.
I am currently using it here.
I found that sorting the largest table so that it is descending takes a long time, which is strange because ascending is fast. Am I doing something wrong?
I'm facing the same issue, sorting an array of approximately 8,000 entries takes 1 to 2 seconds.
I tried to add a loader, however, as soon as you click on the sort button, all JavaScript execution is "blocked".
There's the issue : https://www.loom.com/share/830b1e6ddbff47e4b85bea5424141ea8 --> when I click, console log is showing nothing, and when sort is done, it's going to continue the JavaScript execution.
My code :
let tableHTMLLoader = document.querySelector("#table-loader");
table.on("datatable.init", () => {
document.querySelectorAll(".dataTable-sorter").forEach(sortButton => {
sortButton.addEventListener("click", e => {
console.log("display loader");
console.log(tableHTMLLoader);
tableHTMLLoader.style.display = "flex";
});
});
});
table.on("datatable.sort", () => {
console.log("Hide loader. Disable to test the loader display on `init` event.");
console.log(tableHTMLLoader);
// tableHTMLLoader.style.display = "none";
});
Hey @MKlblangenois @notshi , in version 6 we have a lot fewer dom updates, so that really helps. Please check it out!
Thanks, @johanneswilm - can confirm that it is a lot faster!
It also looks like there has been some style changes since then too so might be a good time to have a poke through and see what else has been updated.
@notshi Take a look at the upgrade instructions in the README.md.
This is great, many thanks, @johanneswilm! This really helped :)