Closed mistyn8 closed 7 years ago
Unfortunately checkbox-group-filter doesn't support multiple categories for now. You may try looking into the following source files:
Group filter service: https://github.com/1rosehip/jplist/blob/master/src/core/js/domain/dom/services/filters/pathGroupFilter.js
Pagination control: https://github.com/1rosehip/jplist/tree/master/src/addons/pagination-bundle/js
So think I found a simple solution to this https://github.com/1rosehip/jplist/blob/cdb8ae0d51ae9e391ae803b9fe890651c72d09dc/src/core/js/domain/dom/collections/dataitems.js#L79
//create paging object
paging = new jQuery.fn.jplist.PaginationService(currentPage, itemsPerPage, context.dataview.length);
I updated to determine length of unique dataview items based on index.
var unique = {};
var distinct = [];
context.dataview.forEach(function (x) {
if (!unique[x.index]) {
distinct.push(x.index);
unique[x.index] = true;
}
});
paging = new jQuery.fn.jplist.PaginationService(currentPage, itemsPerPage, distinct.length);
Maybe you could comment on any gotchas on this approach based on your more intimate knowledge of the rest of the code :-)
Looks great. Nice solution 👍
so I have 162 list-items, however if I use checkbox-group-filter and choose all the filter options I then get pagination saying I have 243 items, this is because some list-items exist in multiple categories.
http://www.jonesandpalmer.co.uk/articles/ for the working example.
on page entry we have all options selected and the duplication in the pagination totals. if you click to unselect all, or unselect all filters one by one, the default view is then show all which shows the correct item count of 162.
any pointers for modifying the source to correct for items having multiple groups assigned?