Fix select option removal and pagination update (#10933)

This commit is contained in:
shamoon
2025-09-25 00:42:43 -07:00
committed by GitHub
parent 4ff09c4cf4
commit 5e47069934

View File

@@ -177,10 +177,16 @@ export class CustomFieldEditDialogComponent
} }
public removeSelectOption(index: number) { public removeSelectOption(index: number) {
this.selectOptions.removeAt(index) const globalIndex =
this._allSelectOptions.splice( index + (this.selectOptionsPage - 1) * SELECT_OPTION_PAGE_SIZE
index + (this.selectOptionsPage - 1) * SELECT_OPTION_PAGE_SIZE, this._allSelectOptions.splice(globalIndex, 1)
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
} }
} }