silverstripe / silverstripe-admin

Silverstripe Admin Component
BSD 3-Clause "New" or "Revised" License
25 stars 94 forks source link

ListboxField appears as CheckboxSetField when rendered in a react context #1404

Open torleif opened 1 year ago

torleif commented 1 year ago

A ListboxField should appear as a multi value dropdown field:

ListboxField::create('Test', 'Test', ['0' => 'test1', '1' => 'test2'])

image

However if the elemental item is inline, it appears as a CheckboxSetField:

image

torleif commented 1 year ago

Interestingly, this extension https://packagist.org/packages/silverstripe/tagfield allows a (different looking) multi field dropdown to work

GuySartorelli commented 1 year ago

This isn't actually to do with elemental specifically - this will be the case any time that field is rendered in a react context. The ListboxField doesn't have its own react component, so it falls back on the component defined for MultiSelectField which happens to be a set of checkboxes.

I'm marking this as a feature request. It's not likely to be worked on by the core team any time soon but we'd definitely welcome PRs for this one. Using the react-select library (which is already used for TreeDropdownField and TreeMultiselectField) would be my recommendation.