list.js icon indicating copy to clipboard operation
list.js copied to clipboard

Improve "updated" event

Open scrobbleme opened this issue 6 years ago • 5 comments

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).

scrobbleme avatar Jun 12 '18 09:06 scrobbleme

Hmm, sounds like a reasonable usecase. What do you think about instead adding a specific callback for paginationChange or something like that?

javve avatar Dec 18 '18 21:12 javve

"paginationChange" would be fine es well.

scrobbleme avatar Dec 19 '18 07:12 scrobbleme

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.)

sheffieldnikki avatar Feb 06 '19 17:02 sheffieldnikki

duplicate of #486

YZirkind avatar Mar 18 '21 21:03 YZirkind