You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using scaffolding to generate a has_one field using a model admin.
The has_one field generates a nice dropdownfield. However if the count of objects goes above 100 the field just resorts to numeric Field.
This becomes extremely frustrating from a UX Point of View where the CMS works and looks nice, but if the client adds more than 100 objects then it breaks the experience.
It should at least be configurable?
Offending code.
if ($list->count() < 100) {
$field = new DropdownField($this->name, $title, $list->map('ID', $titleField));
$field->setEmptyString(' ');
} else {
$field = new NumericField($this->name, $title);
}
This isn't mentioned in the documentation either, so it's caught us out where we've put a site live and a customer has raised this as a bug and affected their day-day running as they can't select a has-one object.
Steps to Reproduce
Create a data object with a has_one to another dataobject. Allow scaffolding to create the fields using a model admin.
You'll see a nice dropdown box is used. If you then add over 100 dataobjects. That has_one field resorts to a Numeric Field.
The text was updated successfully, but these errors were encountered:
In this case it's necessary for you to declare a getCMSFields for your custom model, and override this specific field. The default scaffolder isn't intended as a primary source of UX, just a default baseline you can use to get started.
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->replace(
'RelationID',
new DropdownField('RelationID', 'Select Relation', MyObject::get()->map('ID', 'Title')
);
return $fields;
}
Description
When using scaffolding to generate a has_one field using a model admin.
The has_one field generates a nice dropdownfield. However if the count of objects goes above 100 the field just resorts to numeric Field.
This becomes extremely frustrating from a UX Point of View where the CMS works and looks nice, but if the client adds more than 100 objects then it breaks the experience.
It should at least be configurable?
Offending code.
This isn't mentioned in the documentation either, so it's caught us out where we've put a site live and a customer has raised this as a bug and affected their day-day running as they can't select a has-one object.
Steps to Reproduce
Create a data object with a has_one to another dataobject. Allow scaffolding to create the fields using a model admin.
You'll see a nice dropdown box is used. If you then add over 100 dataobjects. That has_one field resorts to a Numeric Field.
The text was updated successfully, but these errors were encountered: