Fixed #1475 - CurrentPageReport displays wrong value
parent
3f5d6a2bf1
commit
2b00a72b7a
|
@ -34,9 +34,9 @@
|
|||
computed: {
|
||||
text() {
|
||||
let text = this.template
|
||||
.replace("{currentPage}", this.page + 1)
|
||||
.replace("{currentPage}", this.pageCount > 0 ? this.page + 1 : 0)
|
||||
.replace("{totalPages}", this.pageCount)
|
||||
.replace("{first}", this.first + 1)
|
||||
.replace("{first}", this.pageCount > 0 ? this.first + 1 : 0)
|
||||
.replace("{last}", Math.min(this.first + this.rows, this.totalRecords))
|
||||
.replace("{rows}", this.rows)
|
||||
.replace("{totalRecords}", this.totalRecords);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<JTPDropdown :modelValue="page" :options="pageOptions" optionLabel="label" optionValue="value"
|
||||
@update:modelValue="onChange($event)" class="p-paginator-page-options"></JTPDropdown>
|
||||
@update:modelValue="onChange($event)" class="p-paginator-page-options" :disabled="disabled"></JTPDropdown>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -12,7 +12,8 @@ export default {
|
|||
emits: ['page-change'],
|
||||
props: {
|
||||
page: Number,
|
||||
pageCount: Number
|
||||
pageCount: Number,
|
||||
disabled: Boolean
|
||||
},
|
||||
methods: {
|
||||
onChange(value) {
|
||||
|
|
|
@ -4,17 +4,17 @@
|
|||
<slot name="left" :state="currentState"></slot>
|
||||
</div>
|
||||
<template v-for="item of templateItems" :key="item">
|
||||
<FirstPageLink v-if="item === 'FirstPageLink'" @click="changePageToFirst($event)" :disabled="isFirstPage" />
|
||||
<PrevPageLink v-else-if="item === 'PrevPageLink'" @click="changePageToPrev($event)" :disabled="isFirstPage" />
|
||||
<NextPageLink v-else-if="item === 'NextPageLink'" @click="changePageToNext($event)" :disabled="isLastPage" />
|
||||
<LastPageLink v-else-if="item === 'LastPageLink'" @click="changePageToLast($event)" :disabled="isLastPage" />
|
||||
<FirstPageLink v-if="item === 'FirstPageLink'" @click="changePageToFirst($event)" :disabled="isFirstPage || empty" />
|
||||
<PrevPageLink v-else-if="item === 'PrevPageLink'" @click="changePageToPrev($event)" :disabled="isFirstPage || empty" />
|
||||
<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"
|
||||
: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)" />
|
||||
:options="rowsPerPageOptions" @rows-change="onRowChange($event)" :disabled="empty"/>
|
||||
<JumpToPageDropdown v-else-if="item === 'JumpToPageDropdown'" :page="page" :pageCount="pageCount"
|
||||
@page-change="changePage($event)" />
|
||||
@page-change="changePage($event)" :disabled="empty"/>
|
||||
</template>
|
||||
<div class="p-paginator-right-content" v-if="$slots.right">
|
||||
<slot name="right" :state="currentState"></slot>
|
||||
|
@ -149,7 +149,7 @@ export default {
|
|||
return Math.floor(this.d_first / this.d_rows);
|
||||
},
|
||||
pageCount() {
|
||||
return Math.ceil(this.totalRecords / this.d_rows) || 1;
|
||||
return Math.ceil(this.totalRecords / this.d_rows);
|
||||
},
|
||||
isFirstPage() {
|
||||
return this.page === 0;
|
||||
|
@ -189,6 +189,9 @@ export default {
|
|||
first: this.d_first,
|
||||
rows: this.d_rows
|
||||
}
|
||||
},
|
||||
empty() {
|
||||
return this.pageCount === 0;
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<RPPDropdown :modelValue="rows" :options="rowsOptions" optionLabel="label" optionValue="value"
|
||||
@update:modelValue="onChange($event)" class="p-paginator-rpp-options"></RPPDropdown>
|
||||
@update:modelValue="onChange($event)" class="p-paginator-rpp-options" :disabled="disabled"></RPPDropdown>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -12,7 +12,8 @@ export default {
|
|||
emits: ['rows-change'],
|
||||
props: {
|
||||
options: Array,
|
||||
rows: Number
|
||||
rows: Number,
|
||||
disabled: Boolean
|
||||
},
|
||||
methods: {
|
||||
onChange(value) {
|
||||
|
|
Loading…
Reference in New Issue