Answer the question
In order to leave comments, you need to log in
How to make friends pagination and filtering?
There is a pagination method:
getPages() {
let elemsOnPage = 5;
if (elemsOnPage !== 0) {
let pagesArr = [];
let pageNum = Math.ceil(this.tableList.length / elemsOnPage);
for (let j = 0; j < pageNum; j++) {
this.pageNum.push(j);
}
for (let i = 0; i < pageNum; i++) {
pagesArr.push(this.tableList.slice(i * elemsOnPage, (i + 1) * elemsOnPage));
}
this.filteredPages = cloneDeep(pagesArr);
}
},
<tr v-for="tableItem in filteredPages[activePage]" :key="tableItem.id"></tr>
filteredTableList() {
return this.tableList
.filter(el => {
if (!this.commitModelForSort) {
return true;
}
return el.commit === this.commitModelForSort;
})
.filter(el => {
if (!this.rotationModelForSort) {
return true;
}
return el.rotationName === this.rotationModelForSort;
})
.filter(el => {
if (!this.roleModelForSort) {
return true;
}
return el.role === this.roleModelForSort;
});
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question