mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
fix: fixed pagination problem
This commit is contained in:
1 parent
478bb7e23a
commit
670de0285f
2 files changed
+7
-5
No files matched your search
@@ -6,11 +6,13 @@
|
||||
export let offset: number;
|
||||
|
||||
const totalPages = Math.ceil(totalItems / pageSize);
|
||||
let currentPage = offset / pageSize + 1;
|
||||
let currentPage = Math.floor(offset / pageSize + 1);
|
||||
console.log(currentPage);
|
||||
|
||||
function handleOptionClick(page) {
|
||||
if (currentPage !== page) {
|
||||
offset = pageSize * page - 1;
|
||||
offset = pageSize * (page - 1);
|
||||
console.log(offset);
|
||||
currentPage = page;
|
||||
dispatch('change');
|
||||
}
|
||||
@@ -18,11 +20,11 @@
|
||||
function handleButtonPage(direction) {
|
||||
if (direction === 'next' && currentPage < totalPages) {
|
||||
currentPage += 1;
|
||||
offset = pageSize * currentPage - 1;
|
||||
offset = pageSize * (currentPage - 1);
|
||||
dispatch('change');
|
||||
} else if (direction === 'prev' && currentPage > 1) {
|
||||
currentPage -= 1;
|
||||
offset = pageSize * currentPage - 1;
|
||||
offset = pageSize * (currentPage - 1);
|
||||
dispatch('change');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
let search = '';
|
||||
let showCreate = false;
|
||||
let offset = 0;
|
||||
const limit = 1;
|
||||
const limit = 5;
|
||||
|
||||
const project = $page.params.project;
|
||||
const getAvatar = (name: string) => sdkForProject.avatars.getInitials(name, 30, 30).toString();
|
||||
|
||||
Reference in new issue
Block a user