Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Fix select option removal and pagination update (#10933)

shamoon5e4706993471
diff --git a/src-ui/src/app/components/common/edit-dialog/custom-field-edit-dialog/custom-field-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/custom-field-edit-dialog/custom-field-edit-dialog.component.ts
index 617d825b2..8e8bddfab 100644
--- a/src-ui/src/app/components/common/edit-dialog/custom-field-edit-dialog/custom-field-edit-dialog.component.ts
+++ b/src-ui/src/app/components/common/edit-dialog/custom-field-edit-dialog/custom-field-edit-dialog.component.ts
@@ -177,10 +177,16 @@ export class CustomFieldEditDialogComponent
}
public removeSelectOption(index: number) {
- this.selectOptions.removeAt(index)
- this._allSelectOptions.splice(
- index + (this.selectOptionsPage - 1) * SELECT_OPTION_PAGE_SIZE,
- 1
+ const globalIndex =
+ index + (this.selectOptionsPage - 1) * SELECT_OPTION_PAGE_SIZE
+ this._allSelectOptions.splice(globalIndex, 1)
+
+ const totalPages = Math.max(
+ 1,
+ Math.ceil(this._allSelectOptions.length / SELECT_OPTION_PAGE_SIZE)
)
+ const targetPage = Math.min(this.selectOptionsPage, totalPages)
+
+ this.selectOptionsPage = targetPage
}
}