flaviusmatis / flaviusmatis/simplePagination.js

if you have trouble with bootstrap flex hide issue you have to remove the class first then hide it

Open
#161 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
777
Forks
397
PR merge metrics
No merged PRs in 30d

Description

var items = $(".list-wrapper .part_data");
var numItems = items.length;
var perPage = 5;

//remove class first then hide
items.slice(perPage).removeClass("list-group-item list-group-item-action d-flex align-items-center part_data").hide();

$('#pagination-container').pagination({
items: numItems,
itemsOnPage: perPage,
prevText: "«",
nextText: "»",
onPageClick: function (pageNumber) {
var showFrom = perPage * (pageNumber - 1);
var showTo = showFrom + perPage;

//remove curent showing active class then hide, and the new list add the class again then show
items.removeClass("list-group-item list-group-item-action d-flex align-items-center part_data").hide().slice(showFrom, showTo).addClass("list-group-item list-group-item-action d-flex align-items-center part_data").show();

}
});

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the reported pagination behavior with the provided .list-wrapper .part_data snippet and Bootstrap flex classes, then inspect the pagination callback that hides and shows items. Done means paginated items can be hidden and shown without requiring the listed classes to be removed and re-added.

Written by the indexing model from the issue text.

Assessment

Tech stack
bootstrap, javascript, jquery
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.