Skip to content

Commit

Permalink
Simplified paging rendering logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbum committed Aug 20, 2024
1 parent 4c873d9 commit 4b7135a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/js/cagov-paginator.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,16 @@ class CAGovPaginator extends HTMLElement {

drawCurrentPage() {
console.log("drawCurrentPage",this.currentPage);
this.pagedContainer.innerHTML = "";

this.pagedBlocks.forEach((block,index) => {
var displayStyle = "none";
if (index >= (this.currentPage - 1) * this.perPage && index < this.currentPage * this.perPage) {
this.pagedContainer.appendChild(block);
displayStyle = "block";
}
block.style.display = displayStyle;
});


location.hash = `#page-${this.currentPage}`;
// console.log("location.hash",location.hash);
}
Expand Down

0 comments on commit 4b7135a

Please sign in to comment.