Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a dropdown FormField which gets its source via AJAX #1618

Closed
7 of 8 tasks
GuySartorelli opened this issue Nov 5, 2023 · 6 comments
Closed
7 of 8 tasks

Implement a dropdown FormField which gets its source via AJAX #1618

GuySartorelli opened this issue Nov 5, 2023 · 6 comments

Comments

@GuySartorelli
Copy link
Member

GuySartorelli commented Nov 5, 2023

As a follow-on from silverstripe/silverstripe-cms#2901, we need a form field that uses AJAX requests to lazy-load its data.

Required functionality

  • Initial list isn't injected into the front end - if it's a DataList, no DB query is initiated at all when sending the initial form to the front-end
  • When user click on the field, an AJAX request is fired to get some initial results. The initial results is limited to some sane number.
  • As user types into the field, AJAX requests are fired with the current field value. The response is a subset of the original list, filtered by the user input
  • If user types the same value a second time, a second AJAX request is not sent - in-memory cache is used instead to fetch the results that were previously received for that search term
  • in-memory cache is per instance of the field - it is not shared between even identical fields, and it is immediately discarded when the field is de-rendered.

Acceptance criteria

  • Either a new field is implemented with the above functionality, or the above functionality is added to an existing field (e.g. ListboxField)
  • The above functionality works in both react and entwine contexts
  • The temporary workaround from 5.1: Can't open settings tab of SiteTree objects, if you have a lot of members silverstripe-cms#2901 is removed
  • The new implementation is in use for all fields that fetch Member records by default (e.g. the "only these users" fields in cms, asset-admin, and siteconfig)
  • The new implementation is used instead of dropdown field for auto-scaffolding has_one relation fields (NOTE: We only do this if it's 100% backwards compatible with the existing form field, in terms of its public API)
  • Validate the UX of the new field with our design team
  • There's a field that allows you to select a single value and there's a field that allows you to select multiple values.

Notes

  • The silverstripe/tagfield implementation has this functionality - we can likely grab a lot of that code and reuse it in core.
  • The TreeDropDown field that uses a similar approach as well.
  • Might be worthwhile reviewing which fields have AJAX search capabilities.

New issues created

PRs

@GuySartorelli GuySartorelli added this to the Silverstripe CMS 5.2 milestone Nov 5, 2023
@emteknetnz emteknetnz assigned emteknetnz and unassigned emteknetnz Dec 8, 2023
@emteknetnz
Copy link
Member

emteknetnz commented Dec 15, 2023

Yup

image

Have added PR to this issue - #1636

@GuySartorelli
Copy link
Member Author

@emteknetnz Please resolve silverstripe/silverstripe-framework#11071 before reassigning to me

@GuySartorelli
Copy link
Member Author

PRs merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants