javve / list.js

The perfect library for adding search, sort, filters and flexibility to tables, lists and various HTML elements. Built to be invisible and work on existing HTML.
https://listjs.com
MIT License
11.2k stars 898 forks source link

on('updated') not fired on start #731

Open hamburger123456 opened 3 years ago

hamburger123456 commented 3 years ago

I woud like to have a info-line with my table. I created this:

`hackerList.on('updated', function(list) {
  if (list.matchingItems.length > 0) {
    var currentPage = Math.ceil(list.i / list.page);
    document.querySelector('.infoText').innerHTML = `Showing ${list.i} to ${list.i+list.visibleItems.length-1} of ${list.matchingItems.length} entries on page ${currentPage} with ${list.visibleItems.length} items.`
  } else {
    console.log("liste ist leer");
  }
})`

This works fine but not on start. Is there any way to get this run on start (If I look at the code there is a self.trigger('updated') in the update-function. Which will run at start also. But update is not fired.)