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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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
} }
} }