-
Notifications
You must be signed in to change notification settings - Fork 824
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
NEW SearchableDropdownField #11057
NEW SearchableDropdownField #11057
Conversation
00bbb80
to
f667e30
Compare
f667e30
to
128cf01
Compare
f6356dc
to
849d175
Compare
I've only tested this using the "only these users" field so far, but in that scenario the lazy load limit doesn't seem to be applying - I have a lot more than just 10 items displaying. |
324b4e9
to
1adb5ab
Compare
f2acbac
to
84f40ed
Compare
The problem mentioned in #11057 (comment) has still not been fixed |
Not sure if this is an admin or a framework PR problem, but with a many_many list, the values aren't saved (or, if they are saved, they at least don't display in the field after saving) Code: use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Forms\SearchableMultiDropdownField;
use SilverStripe\Taxonomy\TaxonomyTerm;
class Page extends SiteTree
{
private static $many_many = [
'Terms' => TaxonomyTerm::class
];
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldsToTab('Root.Main', [
SearchableMultiDropdownField::create('Terms', 'Terms', TaxonomyTerm::get(), $this->Terms(), 'Name'),
]);
return $fields;
}
} Update: The same thing happens for a |
That's the default behaviour of the existing Dropdownfield and I replicated it. It's a really obnoxious default behaviour IMO though can be switched off by just called |
Your code example worked fine on my computer, the values saved, did you forget to dev build flush? |
84f40ed
to
333a74a
Compare
333a74a
to
8c89956
Compare
I did not forget - though clearly either I did something wrong, or the latest batches of changes fixed it, because it works now 👍 |
That's not the expected behaviour in my mind. Just because My recommendation is to call |
This still needs to be addressed: #11057 (comment) |
8c89956
to
4772861
Compare
Have added the $this->setHasEmptyDefault(true) on the single dropdown contructor Have rebased to get https://github.com/silverstripe/silverstripe-framework/pull/11073/files which solves the lazyLoad limit not being respected |
a71d2cd
to
17a3acc
Compare
As discussed in person, please set the default lazy-load limit to 100 |
17a3acc
to
23eca53
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, works great locally.
Issue silverstripe/silverstripe-admin#1618
This PR is derived from silverstripe/tagfield
Note that it differs from tagfield in that it uses "ID" (int) for "Value" rather than "Title" (string) which was fine for simply creating tags, but not appropriate for regular relations. This means this field cannot be used for creating new objects like tagfield can, so it's not a full replacement for tagfield.
Admin PR
For method signatures that don't match parent classes e.g.
SingleSelectField
it's because they now either have strong return types, or looser params defined in docblocks. This is allowed in PHP via covariance (tighter return types on sublasses) and contravariance (looser param types on subclasses) - https://www.php.net/manual/en/language.oop5.variance.php