From 8cd6912fee91b4c0fdfba5fb329b31ccfe0924de Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Thu, 15 Feb 2024 09:13:07 +0200 Subject: [PATCH] fix record prev/next if no total --- client/src/views/record/detail.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client/src/views/record/detail.js b/client/src/views/record/detail.js index ba5767e62e..a66a03c563 100644 --- a/client/src/views/record/detail.js +++ b/client/src/views/record/detail.js @@ -1758,14 +1758,17 @@ class DetailRecordView extends BaseRecordView { previousButtonEnabled = true; } - if (this.indexOfRecord < this.model.collection.total - 1) { + const total = this.model.collection.total !== undefined ? + this.model.collection.total : this.model.collection.length; + + if (this.indexOfRecord < total - 1) { nextButtonEnabled = true; } else { - if (this.model.collection.total === -1) { + if (total === -1) { nextButtonEnabled = true; } - else if (this.model.collection.total === -2) { + else if (total === -2) { if (this.indexOfRecord < this.model.collection.length - 1) { nextButtonEnabled = true; }