export default class Label { constructor(actualPage, totalPages, recordsCount, totalRecords) { this.actualPage = actualPage; this.totalPages = totalPages; this.recordsCount = recordsCount; this.totalRecords = totalRecords; } render(){ this.paginationLabel = document.createElement('div'); this.paginationLabel.classList.add('col-12'); this.pageLabel = document.createElement('span'); this.pageLabel.innerText = `Page: ${this.actualPage} of ${this.totalPages} | `; this.recordLabel = document.createElement('span'); this.recordLabel.innerText = `${this.recordsCount} of ${this.totalRecords} records shown`; this.paginationLabel.appendChild(this.pageLabel); this.paginationLabel.appendChild(this.recordLabel); return this.paginationLabel; } rerender() { this.pageLabel.innerText = `Page: ${this.actualPage} of ${this.totalPages} | `; this.recordLabel.innerText = `${this.recordsCount} of ${this.totalRecords} records shown`; } updateLabel(page, perPage, totalPages){ this.actualPage = page; this.perPage = perPage; this.rerender(); } }