ปรับ paging ประวัติการลงเวลา
This commit is contained in:
parent
21e1016cae
commit
5cca23b11d
2 changed files with 30 additions and 17 deletions
|
|
@ -77,25 +77,34 @@ const props = defineProps({
|
|||
},
|
||||
})
|
||||
|
||||
// Pagination - page & change page & get new data
|
||||
const currentPage = ref<number>(1)
|
||||
watch(currentPage, () => {
|
||||
console.log(currentPage.value)
|
||||
props.changePage(currentPage.value, props.pageSize, true)
|
||||
})
|
||||
const emit = defineEmits(['update:change-page'])
|
||||
|
||||
// Pagination - initial pagination
|
||||
const initialPagination = ref<any>({
|
||||
sortBy: null,
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 1,
|
||||
rowsPerPage: props.pageSize, // set ตาม page หลักส่งมา
|
||||
})
|
||||
|
||||
// Pagination - page & change page & get new data
|
||||
const currentPage = ref<number>(1)
|
||||
watch(
|
||||
[() => currentPage.value, () => initialPagination.value.rowsPerPage],
|
||||
() => {
|
||||
emit(
|
||||
'update:change-page',
|
||||
currentPage.value,
|
||||
initialPagination.value.rowsPerPage,
|
||||
true
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
// Pagination - update rowsPerPage
|
||||
async function updatePagination(newPagination: any) {
|
||||
props.changePage(1, newPagination.rowsPerPage, true)
|
||||
initialPagination.value = newPagination
|
||||
currentPage.value = 1 // set current page เป็น 1 เสมอเมื่อเปลี่ยน per row
|
||||
}
|
||||
|
||||
/** column history table */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue