From 570f886a1f64fe7d04bb145c59a79cad1842e2ff Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Mon, 18 Mar 2024 13:54:28 +0200 Subject: [PATCH] reseting collection offset --- client/src/views/email/list.js | 2 ++ client/src/views/list-with-categories.js | 9 ++++++++- client/src/views/record/list.js | 3 +++ client/src/views/record/search.js | 2 ++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/client/src/views/email/list.js b/client/src/views/email/list.js index 5c9186e5f3..e8c27da27a 100644 --- a/client/src/views/email/list.js +++ b/client/src/views/email/list.js @@ -455,6 +455,8 @@ class EmailListView extends ListView { Espo.Ui.notify(' ... '); + this.collection.offset = 0; + xhr = this.collection .fetch() .then(() => Espo.Ui.notify(false)); diff --git a/client/src/views/list-with-categories.js b/client/src/views/list-with-categories.js index 4558c04970..9a444a8408 100644 --- a/client/src/views/list-with-categories.js +++ b/client/src/views/list-with-categories.js @@ -70,6 +70,8 @@ class ListWithCategories extends ListView { setup() { super.setup(); + this.defaultMaxSize = this.collection.maxSize; + if (!this.categoryScope) { this.categoryScope = this.scope + 'Category'; } @@ -327,6 +329,8 @@ class ListWithCategories extends ListView { this.nestedCategoriesCollection.reset(); this.collection.reset(); + this.collection.offset = 0; + this.collection.maxSize = this.defaultMaxSize; this.$listContainer.empty(); @@ -530,8 +534,11 @@ class ListWithCategories extends ListView { this.currentCategoryName = model.get('name'); } - this.applyCategoryToCollection(); + this.collection.offset = 0; + this.collection.maxSize = this.defaultMaxSize; + this.collection.reset(); + this.applyCategoryToCollection(); this.collection.abortLastFetch(); Espo.Ui.notify(' ... '); diff --git a/client/src/views/record/list.js b/client/src/views/record/list.js index 5bd4010634..0b24551953 100644 --- a/client/src/views/record/list.js +++ b/client/src/views/record/list.js @@ -731,6 +731,7 @@ class ListRecordView extends View { } resetCustomOrder() { + this.collection.offset = 0; this.collection.resetOrderToDefault(); this.collection.trigger('order-changed'); @@ -765,6 +766,8 @@ class ListRecordView extends View { this.collection.pop(); } + this.collection.offset = 0; + this.collection .sort(orderBy, order) .then(() => { diff --git a/client/src/views/record/search.js b/client/src/views/record/search.js index d753bcc051..29775406f4 100644 --- a/client/src/views/record/search.js +++ b/client/src/views/record/search.js @@ -322,6 +322,8 @@ class SearchView extends View { } } + this.collection.offset = 0; + if (toTriggerEvent) { this.trigger('change-view-mode', mode); }