Fixed #27 - Reset DataTable page after sort
parent
c7572be841
commit
2bc824e5b9
|
@ -11,7 +11,7 @@
|
|||
<div class="p-datatable-header" v-if="$scopedSlots.header">
|
||||
<slot name="header"></slot>
|
||||
</div>
|
||||
<DTPaginator v-if="paginatorTop" :rows="rows" :first="first" :totalRecords="totalRecordsLength" :pageLinkSize="pageLinkSize" :template="paginatorTemplate" :rowsPerPageOptions="rowsPerPageOptions"
|
||||
<DTPaginator v-if="paginatorTop" :rows="d_rows" :first="d_first" :totalRecords="totalRecordsLength" :pageLinkSize="pageLinkSize" :template="paginatorTemplate" :rowsPerPageOptions="rowsPerPageOptions"
|
||||
:currentPageReportTemplate="currentPageReportTemplate" class="p-paginator-top" @page="onPage($event)" :alwaysShow="alwaysShowPaginator">
|
||||
<template #left v-if="$scopedSlots.paginatorLeft">
|
||||
<slot name="paginatorLeft"></slot>
|
||||
|
@ -61,7 +61,7 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<DTPaginator v-if="paginatorBottom" :rows="rows" :first="first" :totalRecords="totalRecordsLength" :pageLinkSize="pageLinkSize" :template="paginatorTemplate" :rowsPerPageOptions="rowsPerPageOptions"
|
||||
<DTPaginator v-if="paginatorBottom" :rows="d_rows" :first="d_first" :totalRecords="totalRecordsLength" :pageLinkSize="pageLinkSize" :template="paginatorTemplate" :rowsPerPageOptions="rowsPerPageOptions"
|
||||
:currentPageReportTemplate="currentPageReportTemplate" class="p-paginator-bottom" @page="onPage($event)" :alwaysShow="alwaysShowPaginator">
|
||||
<template #left v-if="$scopedSlots.paginatorLeft">
|
||||
<slot name="paginatorLeft"></slot>
|
||||
|
@ -283,6 +283,7 @@ export default {
|
|||
},
|
||||
onColumnHeaderClick(event, column) {
|
||||
if (column.sortable) {
|
||||
this.resetPage();
|
||||
const targetNode = event.target;
|
||||
const columnField = column.field || column.sortField;
|
||||
|
||||
|
@ -829,6 +830,10 @@ export default {
|
|||
}
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
},
|
||||
resetPage() {
|
||||
this.d_first = 0;
|
||||
this.$emit('update:first', this.d_first);
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
Loading…
Reference in New Issue