list.js
list.js copied to clipboard
Improve "updated" event
Hello,
It would be great if the updated event could have some parameters, ie. the original event.
Our specific use case: we want to do something if the paging was invoked (scroll to top of list).
Hmm, sounds like a reasonable usecase. What do you think about instead adding a specific callback for paginationChange
or something like that?
"paginationChange" would be fine es well.
My use case for something like paginationChange
is for Double pagination, where if the user has clicked on paginationBottom I'd like to override the browser scroll position after the list has been updated, so that the paginationBottom element is visible at the bottom of the browser window. e.g.
document.getElementById('paginationBottom').scrollIntoView(false);
(my workaround for now is to use the "onclick" event to set a flag that is then used in my "updated" event handler:
var pBotClick;
document.getElementById('users').addEventListener('click',
function(){pBotClick = false}, true);
document.getElementById('pagesBottom').addEventListener('click',
function(){pBotClick = true}, true);
note addEventListener(..., true)
is during the capturing phase. i.e. before the click can trigger a list.js update.)
duplicate of #486