Fixed #1602 - Paginator's Inputnumber displays index instead of current page

pull/1613/head
Yiğit FINDIKLI 2021-09-23 12:31:47 +03:00
parent 6648de2769
commit c17b67e2f5
3 changed files with 12 additions and 5 deletions

View File

@ -10,6 +10,10 @@
type: Number,
default: 0
},
currentPage: {
type: Number,
default: 0
},
page: {
type: Number,
default: 0
@ -34,7 +38,7 @@
computed: {
text() {
let text = this.template
.replace("{currentPage}", this.pageCount > 0 ? this.page + 1 : 0)
.replace("{currentPage}", this.currentPage)
.replace("{totalPages}", this.pageCount)
.replace("{first}", this.pageCount > 0 ? this.first + 1 : 0)
.replace("{last}", Math.min(this.first + this.rows, this.totalRecords))

View File

@ -16,7 +16,7 @@ export default {
},
methods: {
onChange(value) {
this.$emit('page-change', value);
this.$emit('page-change', value - 1);
}
},
components: {

View File

@ -9,13 +9,13 @@
<NextPageLink v-else-if="item === 'NextPageLink'" @click="changePageToNext($event)" :disabled="isLastPage || empty" />
<LastPageLink v-else-if="item === 'LastPageLink'" @click="changePageToLast($event)" :disabled="isLastPage || empty" />
<PageLinks v-else-if="item === 'PageLinks'" :value="pageLinks" :page="page" @click="changePageLink($event)" />
<CurrentPageReport v-else-if="item === 'CurrentPageReport'" :template="currentPageReportTemplate"
<CurrentPageReport v-else-if="item === 'CurrentPageReport'" :template="currentPageReportTemplate" :currentPage="currentPage"
:page="page" :pageCount="pageCount" :first="d_first" :rows="d_rows" :totalRecords="totalRecords" />
<RowsPerPageDropdown v-else-if="item === 'RowsPerPageDropdown' && rowsPerPageOptions" :rows="d_rows"
:options="rowsPerPageOptions" @rows-change="onRowChange($event)" :disabled="empty"/>
<JumpToPageDropdown v-else-if="item === 'JumpToPageDropdown'" :page="page" :pageCount="pageCount"
<JumpToPageDropdown v-else-if="item === 'JumpToPageDropdown'" :page="page" :pageCount="pageCount"
@page-change="changePage($event)" :disabled="empty"/>
<JumpToPageInput v-else-if="item === 'JumpToPageInput'" :page="page" @page-change="changePage($event)" :disabled="empty"/>
<JumpToPageInput v-else-if="item === 'JumpToPageInput'" :page="currentPage" @page-change="changePage($event)" :disabled="empty"/>
</template>
<div class="p-paginator-right-content" v-if="$slots.right">
<slot name="right" :state="currentState"></slot>
@ -194,6 +194,9 @@ export default {
},
empty() {
return this.pageCount === 0;
},
currentPage() {
return this.pageCount > 0 ? this.page + 1 : 0;
}
},
components: {