Skip to content

Resolve "Cannot reorder single select options when initially creating the field"

Merge Request Checklist

  • changelog.md has been updated if required
  • Documentation has been updated
  • Quality Standards are met
  • The UI/UX has been updated following UI Style Guide
  • The redoc API pages have been updated for any REST API changes
  • The per database user API docs page has been updated for any REST API changes made to endpoints which can be accessed via a user created token
  • Has performance been considered and tested when appropriate? Ideally Baserow should be performant when working with hundreds of thousands of rows
  • New/Changed Premium features are separated correctly in the premium folder
  • There are tests for and it has been checked that any changed/new django ORM code is sensible, doesn't perform N queries and that table models are not generated needlessly or generated with all columns when only a few are needed.

Closes #589 (closed)

Details

  • The select options could not be reordered because when adding a new select option it does not have an ID yet. The order function expects the select option item to have an ID.
  • I created a "temporary" local select option ID so that the items can be ordered. I choose to use a negative ID so that there will be no clash with the IDs coming from the backend (so if we for example edit an already created field with select options that have an ID and we add a new select option).
  • Since now we would send these "local IDs" to the backend in the API request, I implemented the "getFormValues" method on the FieldSelectOptionsSubForm and removed the "temporary" local select option ID to prevent unwanted side effects in the backend.
Edited by Ghost User

Merge request reports