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.19k stars 897 forks source link

refresh() fired after event 'updated' #656

Open djalfe opened 5 years ago

djalfe commented 5 years ago

Hey there First of all, thanks for sharing list.js with us :-)

I'm trying to use MacthHeight on the list, when event 'updated' is triggert, where it look like that list content is not ready todo a match height on. https://github.com/liabru/jquery-match-height

In the code i can se the refresh() function is triggert on event 'updated', should'n refresh() be triggert before event 'updated' ??

https://github.com/javve/list.js/blob/master/dist/list.js#L999-L1001

my code snippet:

var projectContainer = $('#projectlist');
projectContainer .find('.project-item').matchHeight({ byRow: true });

var projectListOptions = {
  valueNames: ['name', 'description', 'year', 'contractor', 'engineers', 'areasize', 'location'],
  page: 12,
  pagination: true
};

var projectList = new List('projectlist', projectListOptions);
projectList.on('updated', function () {
  console.log('updated');
  $.fn.matchHeight._update();
});
Stolzenhain commented 2 months ago

there ist some discussion on the update event at #601 and it not including pager updates. Seeing that you use a pagination that might change, this could change the container height after updating.