javve / list.pagination.js

A pagination plugin for List.js
24 stars 23 forks source link

Pagination removes click listeners #6

Closed lhansford closed 10 years ago

lhansford commented 10 years ago

I have a list that uses jquery click listeners on each item, but when I add pagination the click listeners for all items not on the first page disappear. Is there anyway to get the listeners working on all the items?

javve commented 10 years ago

All items that are not currently shown are removed from the DOM and I guess that it's why they aren't working.

If you init List.js and then tries to add listeners with $('li').click() or something, it wont work.

lhansford commented 10 years ago

Okay, I figured that was what was happening. It might be cool to add an option to allow the user to run some code each time the page changes (don't know how possible that is though).

javve commented 10 years ago

You have listObj.on('updated', function(listObj) { yaddda }); which is called everytime the list changes =)

lhansford commented 10 years ago

That works perfectly, thanks!