Skip to content

Commit cd4b541

Browse files
authored
Merge pull request #8896 from ProcessMaker/bugfix/FOUR-26363
FOUR-26363 | +Case Pagination Is Not Working Correctly
2 parents 2ca4684 + 4d6f281 commit cd4b541

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

resources/js/components/requests/requestModal.vue

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
hide-footer
99
:title="$t('New Case')"
1010
:size="size"
11+
@hidden="hideModal"
1112
>
1213
<progress-loader
1314
ref="progressLoader"
@@ -171,10 +172,21 @@ export default {
171172
},
172173
showModal() {
173174
this.loaded = true;
174-
// Perform initial load of requests from backend
175175
this.$refs.requestModalAdd.show();
176176
this.fetch();
177177
},
178+
hideModal() {
179+
this.loaded = false;
180+
this.filter = "";
181+
this.error = false;
182+
this.processes = {};
183+
this.page = 1;
184+
this.perPage = 15;
185+
const pagination = this.$refs.listProcess;
186+
if (pagination && String(pagination.perPage) !== "15") {
187+
pagination.perPage = "15";
188+
}
189+
},
178190
// Overwrite handler to change the page based on events fired
179191
onPageChange: function onPageChange(page) {
180192
if (page === "next") {
@@ -192,6 +204,19 @@ export default {
192204
}
193205
this.fetch();
194206
},
207+
changePerPage(value) {
208+
const perPage = Number(value);
209+
this.perPage = perPage;
210+
const pagination = this.$refs.listProcess ? this.$refs.listProcess.tablePagination : null;
211+
const total = pagination && pagination.total ? pagination.total : 0;
212+
if (total > 0 && this.page * perPage > total) {
213+
this.page = Math.ceil(total / perPage);
214+
}
215+
if (this.page <= 0) {
216+
this.page = 1;
217+
}
218+
this.fetch();
219+
},
195220
fetch() {
196221
if (!this.loaded) {
197222
return;

0 commit comments

Comments
 (0)