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

Use react-select for react-based dropdowns (SingleSelectField and MultiSelectField) #52

Open
chillu opened this issue May 3, 2017 · 7 comments

Comments

@chillu
Copy link
Member

chillu commented May 3, 2017

Acceptance Criteria

  • I can select a single item in a dropdown
  • I can select a multiple items in a dropdown
  • I can clear selection for single selects
  • I can remove single items for multi selects
  • The field efficiently displays long tiles as selected items
  • The field can present validation errors
  • The field has a useful readonly/disabled presentation
  • The styling looks largely consistent between Entwine and React UIs
  • The styling looks largely consistent with the existing <TreeDropdownField> react component
  • Replace checkboxsetfield with listbox in asset-admin permission selection (see Introduce asset permission model silverstripe-framework#6063)

Notes

  • This will eventually replace our use of ChosenJS as we phase out Entwine-based views
  • We're already using react-select for the new react-based TreeDropdownField
  • Consider combining the UI logic with TreeDropdownField (might not make sense, but please think about it)

Excluded

  • I can lazy load large data sets via XHR

Related

@chillu
Copy link
Member Author

chillu commented May 7, 2017

Overview of current state:

Field Context Library CSS Comment
DropdownField Entwine ChosenJS Custom Supports search as standard ChosenJS feature
DropdownField React Native Bootstrap Converted to a bootstrap-styled dropdown as <SingleSelectField> (without search). To be converted to react-select
ListboxField Entwine ChosenJS Custom Multi select
ListboxField React n/a n/a Not converted yet (should be <MultiSelectField>)
TreeDropdownField Entwine JSTree Custom
TreeDropdownField React react-select react-select with custom
TreeMultiSelectField Entwine JSTree Custom
TreeMultiSelectField React react-select n/a Implemented through (#53)

Updated 17/08/2017

@chillu chillu added this to the CMS 4.0.0-beta2 milestone May 7, 2017
@chillu
Copy link
Member Author

chillu commented Aug 17, 2017

For the moment, this only affects custom dropdowns in the assets and campaigns section, as well as lesser used core dropdowns in the "asset search" advanced form. Those look OK in their default bootstrap styling already. The UX will be slightly different to ChosenJS dropdowns in Entwine UIs (no search abilities in dropdown options), but I doubt many users will notice. Removing from the 4.0 milestone for now.

@tractorcow
Copy link
Contributor

Note: We'll need to support tagfield in react. I'd prefer to see something in this story used to support that feature.

See silverstripe/silverstripe-tagfield#107

@robbieaverill
Copy link
Contributor

Adding a note to the previous comment that the TagField implementation (not complete yet) uses the same react-select library we'd probably end up using here for multi select fields, and ideally TagField would then be refactored to use the core form field instead of re-implementing the same thing.

FWIW the current state of TagField is that the field works in entwine forms but not in React forms (issues: #755 and silverstripe/silverstripe-tagfield#107)

@ScopeyNZ
Copy link
Contributor

This is becoming more of problem as we move more forms to FormBuilder. Listbox is completely different.

@ScopeyNZ
Copy link
Contributor

I think we can probably consider the Listbox problem as a bug. It looks nothing like it's SSViewer counterpart.

@lhalaa
Copy link

lhalaa commented May 31, 2019

Another use case for the ListboxField is for search forms in ModelAdmin. Adding a ListboxField only displays a long list of checkbox fields which is not ideal.

Screen Shot 2019-05-31 at 17 14 07

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

7 participants