mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
API CHANGE Renamed GridFieldDefaultColumns to GridFieldDataColumns #6921
This commit is contained in:
parent
6d0b0d6788
commit
09d6fa7bb3
@ -32,7 +32,7 @@ This example creates exactly the same kind of grid as the previous example, but
|
||||
// Provide a header row with filter controls
|
||||
$config->addComponent(new GridFieldFilterHeader());
|
||||
// Provide a default set of columns based on $summary_fields
|
||||
$config->addComponent(new GridFieldDefaultColumns());
|
||||
$config->addComponent(new GridFieldDataColumns());
|
||||
// Provide a header row with sort controls
|
||||
$config->addComponent(new GridFieldSortableHeader());
|
||||
// Paginate results to 25 items per page, and show a footer with pagination controls
|
||||
@ -44,7 +44,7 @@ If we wanted to make a simpler grid without pagination or filtering, we could do
|
||||
:::php
|
||||
$config = GridFieldConfig::create();
|
||||
// Provide a default set of columns based on $summary_fields
|
||||
$config->addComponent(new GridFieldDefaultColumns());
|
||||
$config->addComponent(new GridFieldDataColumns());
|
||||
// Provide a header row with sort controls
|
||||
$config->addComponent(new GridFieldPaginator(25));
|
||||
$field = new GridField("Members", "Members of this group", $this->group->Members(), $config);
|
||||
@ -57,11 +57,11 @@ A `GridFieldConfig` is made up of a new of `GridFieldComponent` objects, which a
|
||||
`GridFieldComponent` is a family of interfaces.
|
||||
SilverStripe Framework comes with the following components that you can use out of the box.
|
||||
|
||||
### GridFieldDefaultColumns
|
||||
### GridFieldDataColumns
|
||||
|
||||
This is the one component that, in most cases, you must include. It provides the default columns, sourcing them from the underlying DataObject's `$summary_fields` if no specific configuration is provided.
|
||||
|
||||
Without GridFieldDefaultColumns added to a GridField, it would have no columns whatsoever. Although this isn't particularly useful most of the time, we have allowed for this for two reasons:
|
||||
Without GridFieldDataColumns added to a GridField, it would have no columns whatsoever. Although this isn't particularly useful most of the time, we have allowed for this for two reasons:
|
||||
|
||||
* You may have a grid whose fields are generated purely by another non-standard component.
|
||||
* It keeps the core of the GridField lean, focused solely on providing APIs to the components.
|
||||
@ -233,7 +233,7 @@ By default, a grid contains no columns. All the columns displayed in a grid wil
|
||||
|
||||
For example, you may create a grid field with several components providing columns:
|
||||
|
||||
* `GridFieldDefaultColumns` could provide basic data columns.
|
||||
* `GridFieldDataColumns` could provide basic data columns.
|
||||
* An editor component could provide a column containing action buttons on the right.
|
||||
* A multiselect component clould provide a column showing a checkbox on the left.
|
||||
|
||||
|
@ -356,7 +356,7 @@ class HtmlEditorField_Toolbar extends RequestHandler {
|
||||
$fileFieldConfig = GridFieldConfig::create();
|
||||
$fileFieldConfig->addComponent(new GridFieldSortableHeader());
|
||||
$fileFieldConfig->addComponent(new GridFieldFilterHeader());
|
||||
$fileFieldConfig->addComponent(new GridFieldDefaultColumns());
|
||||
$fileFieldConfig->addComponent(new GridFieldDataColumns());
|
||||
$fileFieldConfig->addComponent(new GridFieldPaginator(5));
|
||||
$fileField = new GridField('Files', false, null, $fileFieldConfig);
|
||||
$fileField->setList($this->getFiles($parentID));
|
||||
|
@ -847,7 +847,7 @@ class UploadField_SelectHandler extends RequestHandler {
|
||||
$config = GridFieldConfig::create();
|
||||
$config->addComponent(new GridFieldSortableHeader());
|
||||
$config->addComponent(new GridFieldFilterHeader());
|
||||
$config->addComponent(new GridFieldDefaultColumns());
|
||||
$config->addComponent(new GridFieldDataColumns());
|
||||
$config->addComponent(new GridFieldPaginator(10));
|
||||
|
||||
$field = new GridField('Files', false, $folder->stageChildren(), $config);
|
||||
|
@ -404,7 +404,7 @@ class GridField extends FormField {
|
||||
array(
|
||||
"class" => implode(' ', $classes),
|
||||
'data-id' => $record->ID,
|
||||
// TODO Allow per-row customization similar to GridFieldDefaultColumns
|
||||
// TODO Allow per-row customization similar to GridFieldDataColumns
|
||||
'data-class' => $record->ClassName,
|
||||
),
|
||||
$rowContent
|
||||
|
@ -36,7 +36,7 @@ interface GridField_ColumnProvider extends GridFieldComponent {
|
||||
|
||||
/**
|
||||
* Modify the list of columns displayed in the table.
|
||||
* See {@link GridField->getDisplayFields()} and {@link GridFieldDefaultColumns}.
|
||||
* See {@link GridField->getDisplayFields()} and {@link GridFieldDataColumns}.
|
||||
*
|
||||
* @param GridField
|
||||
* @param Array List reference of all column names.
|
||||
|
@ -134,7 +134,7 @@ class GridFieldConfig_Base extends GridFieldConfig {
|
||||
$this->addComponent(new GridFieldToolbarHeader());
|
||||
$this->addComponent(new GridFieldSortableHeader());
|
||||
$this->addComponent(new GridFieldFilterHeader());
|
||||
$this->addComponent(new GridFieldDefaultColumns());
|
||||
$this->addComponent(new GridFieldDataColumns());
|
||||
$this->addComponent(new GridFieldPaginator($itemsPerPage));
|
||||
}
|
||||
}
|
||||
@ -161,7 +161,7 @@ class GridFieldConfig_RecordEditor extends GridFieldConfig {
|
||||
$this->addComponent(new GridFieldToolbarHeader());
|
||||
$this->addComponent(new GridFieldSortableHeader());
|
||||
$this->addComponent(new GridFieldFilterHeader());
|
||||
$this->addComponent(new GridFieldDefaultColumns());
|
||||
$this->addComponent(new GridFieldDataColumns());
|
||||
$this->addComponent(new GridFieldEditButton());
|
||||
$this->addComponent(new GridFieldDeleteAction());
|
||||
$this->addComponent(new GridFieldPaginator($itemsPerPage));
|
||||
@ -204,7 +204,7 @@ class GridFieldConfig_RelationEditor extends GridFieldConfig {
|
||||
$this->addComponent(new GridFieldAddExistingAutocompleter());
|
||||
$this->addComponent(new GridFieldSortableHeader());
|
||||
$this->addComponent(new GridFieldFilterHeader());
|
||||
$this->addComponent(new GridFieldDefaultColumns());
|
||||
$this->addComponent(new GridFieldDataColumns());
|
||||
$this->addComponent(new GridFieldEditButton());
|
||||
$this->addComponent(new GridFieldDeleteAction(true));
|
||||
$this->addComponent(new GridFieldPaginator($itemsPerPage));
|
||||
|
@ -6,7 +6,7 @@
|
||||
* @package sapphire
|
||||
* @subpackage fields-relational
|
||||
*/
|
||||
class GridFieldDefaultColumns implements GridField_ColumnProvider {
|
||||
class GridFieldDataColumns implements GridField_ColumnProvider {
|
||||
|
||||
public function augmentColumns($gridField, &$columns) {
|
||||
$baseColumns = array_keys($gridField->getDisplayFields());
|
@ -32,7 +32,7 @@ class GridFieldTest extends SapphireTest {
|
||||
new GridFieldToolbarHeader(),
|
||||
new GridFieldSortableHeader,
|
||||
new GridFieldFilterHeader,
|
||||
new GridFieldDefaultColumns,
|
||||
new GridFieldDataColumns,
|
||||
new GridFieldPaginator,
|
||||
new GridState_Component,
|
||||
));
|
||||
@ -48,13 +48,13 @@ class GridFieldTest extends SapphireTest {
|
||||
|
||||
$config = GridFieldConfig::create();
|
||||
$config->addComponent(new GridFieldSortableHeader());
|
||||
$config->addComponent(new GridFieldDefaultColumns());
|
||||
$config->addComponent(new GridFieldDataColumns());
|
||||
|
||||
$obj = new GridField('testfield', 'testfield', ArrayList::create(array()),$config);
|
||||
|
||||
$expectedComponents = new ArrayList(array(
|
||||
0 => new GridFieldSortableHeader,
|
||||
1 => new GridFieldDefaultColumns,
|
||||
1 => new GridFieldDataColumns,
|
||||
2 => new GridState_Component,
|
||||
));
|
||||
|
||||
@ -430,7 +430,7 @@ class GridFieldTest extends SapphireTest {
|
||||
));
|
||||
|
||||
$config = new GridFieldConfig();
|
||||
$config->addComponent(new GridFieldDefaultColumns());
|
||||
$config->addComponent(new GridFieldDataColumns());
|
||||
$obj = new GridField('testfield', 'testfield', $list, $config);
|
||||
$form = new Form(new Controller(), 'mockform', new FieldList(array($obj)), new FieldList());
|
||||
$content = new CSSContentParser($obj->FieldHolder());
|
||||
|
@ -75,7 +75,7 @@ class GridFieldAddExistingAutocompleterTest_Controller extends Controller implem
|
||||
$player = DataObject::get('GridFieldTest_Player')->find('Email', 'player1@test.com');
|
||||
$config = GridFieldConfig::create()->addComponents(
|
||||
$relationComponent = new GridFieldAddExistingAutocompleter('Name'),
|
||||
new GridFieldDefaultColumns()
|
||||
new GridFieldDataColumns()
|
||||
);
|
||||
$field = new GridField('testfield', 'testfield', $player->Teams(), $config);
|
||||
return new Form($this, 'Form', new FieldList($field), new FieldList());
|
||||
|
Loading…
Reference in New Issue
Block a user