mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Address PR feedback for Search changelog
This commit is contained in:
parent
191d93697d
commit
14a8707bf2
@ -5,7 +5,7 @@
|
|||||||
- `DataList::column()` now returns all values and not just "distinct" values from a column as per the API docs
|
- `DataList::column()` now returns all values and not just "distinct" values from a column as per the API docs
|
||||||
- `DataList`, `ArrayList` and `UnsavedRalationList` all have `columnUnique()` method for fetching distinct column values
|
- `DataList`, `ArrayList` and `UnsavedRalationList` all have `columnUnique()` method for fetching distinct column values
|
||||||
- Take care with `stageChildren()` overrides. `Hierarchy::numChildren() ` results will only make use of `stageChildren()` customisations that are applied to the base class and don't include record-specific behaviour.
|
- Take care with `stageChildren()` overrides. `Hierarchy::numChildren() ` results will only make use of `stageChildren()` customisations that are applied to the base class and don't include record-specific behaviour.
|
||||||
- New react-based search UI for the CMS, Asset-Admin, GridFields and ModelAdmins.
|
- New React-based search UI for the CMS, Asset-Admin, GridFields and ModelAdmins.
|
||||||
|
|
||||||
## Upgrading {#upgrading}
|
## Upgrading {#upgrading}
|
||||||
|
|
||||||
@ -16,11 +16,13 @@ If this behaviour is still required, please use `columnUnique()` instead.
|
|||||||
|
|
||||||
### Using legacy GridField search API
|
### Using legacy GridField search API
|
||||||
|
|
||||||
GridFields now default to using the new search UI which uses [SilverStripe's FormSchema API](https://api.silverstripe.org/master/SilverStripe/Forms/Schema/FormSchema.html).
|
GridFields now default to using the new search UI which uses [SilverStripe's FormSchema API](api:SilverStripe\Forms\Schema\FormSchema).
|
||||||
|
|
||||||
If you would rather continue using the old search API, you can remove the default `GridFieldFilterHeader` from your GridField configuration and replace with one whose _legacy_ flag has been enabled.
|
If you would rather continue using the old search API, you can remove the default `GridFieldFilterHeader` from your GridField configuration and replace with one whose _legacy_ flag has been enabled.
|
||||||
|
|
||||||
To enable legacy mod on a `GridFieldFilterHeader`, just pass `true` to the first argument of its constructor.
|
To enable the legacy search API on a `GridFieldFilterHeader`, you can either:
|
||||||
|
* set the `useLegacyFilterHeader` property to `true`,
|
||||||
|
* or pass `true` to the first argument of its constructor.
|
||||||
|
|
||||||
```php
|
```php
|
||||||
public function getCMSFields()
|
public function getCMSFields()
|
||||||
@ -28,13 +30,11 @@ public function getCMSFields()
|
|||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields();
|
||||||
|
|
||||||
// Configure grid field to use legacy search API
|
// Configure grid field to use legacy search API
|
||||||
$legacySearchApiFlag = true;
|
|
||||||
$config = new GridFieldConfig_RecordEditor();
|
$config = new GridFieldConfig_RecordEditor();
|
||||||
$config->removeComponentsByType(GridFieldFilterHeader::class);
|
$config->getComponentsByType(GridFieldFilterHeader::class)->useLegacyFilterHeader = true;
|
||||||
$config->addComponent(new GridFieldFilterHeader($legacySearchApiFlag));
|
|
||||||
|
|
||||||
$grid = new GridField('Companies', 'Companies', new DataList(Company::class), $config);
|
$grid = GridField::create('Companies', 'Companies', DataList::create(Company::class), $config);
|
||||||
$fields->addFieldToTab('Root.Compagnu', $grid);
|
$fields->addFieldToTab('Root.Company', $grid);
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user