I have played with infinitive scrolling with some success, Used Javascript to get the offset and let the server load next 100 records from the database.
const tbody = document.querySelector('tbody');
tbody.addEventListener('scroll', function () {
if (tbody.scrollHeight - tbody.scrollTop <= tbody.clientHeight) {
let rows = document.querySelectorAll('tr');
let offset = rows[rows.length - 1].rowIndex;
next_page(offset);
}
});
function next_page(offset) {
let url = '/tsk/tr/' + offset
fetch(url)
.then((res) => res.text())
.then((response) => {
tbody.insertAdjacentHTML('beforeend', response);
})
.catch((error) => alert("Error content:", error));
}
This works as I expected, but I think this can be improved. If you have any suggestions, I should be thankful.