lekoala/ss-gridfield-utils
最新稳定版本:1.0.0
Composer 安装命令:
composer require lekoala/ss-gridfield-utils
包简介
A collection of GridField components that you can use with any GridField, including Editable Rows and amy more
README 文档
README
This module includes a subset of GridField Utilities for SilverStripe 4 and 5.
Includes the following (note they all live in the namespace LeKoala\GridFieldUtils):
- AddNewInlineExtended: A more complex version of GridFieldAddNewInlineButton, allowing you to set custom fields, rather than copying GridFieldEditableColumns (defaults to this behaviour)
- EditableRow: adds an expandable form to each row in the GridField, allowing you to edit records directly from the GridField.
- HasOneSelector: Allow you to select a has one relation from the current GridField
- AddExistingPicker: Works exactly like the one in gridfieldextensions, except it allows you to add more before closing the window - allowing for a faster workflow (requires silverstripe-australia/gridfieldextensions)
Caveats
- A deep nested EditableRow will be very slow, since it has many request handlers to access, but not much I can do about this behaviour...
Examples
HasOneSelector
$grid = new GridField('Tags', 'Tags', $this->Tags(), new GridFieldConfig); $grid->getConfig()->addComponent($component = new HasOneSelector('MainTag', 'Select main tag')); // Configure any public property... $component->showResetButton = true;
AddNewInlineExtended
$grid->getConfig()->addComponent(GridFieldButtonRow::create('before')) ->addComponent(GridFieldToolbarHeader::create()) ->addComponent(GridFieldTitleHeader::create()) ->addComponent(GridFieldEditableColumns::create()) ->addComponent(GridFieldDeleteAction::create()) ->addComponent(AddNewInlineExtended::create())
EditableRow
$grid = new GridField('Tags', 'Tags', $this->Tags(), GridFieldConfig_RecordEditor::create()); $grid->getConfig()->addComponent($component = new EditableRow());
AddExistingPicker
$grid = new GridField('Tags', 'Tags', $this->Tags(), GridFieldConfig_RelationEditor::create()); $grid->getConfig()->addComponent($component = new AddExistingPicker()); // instead of... // $grid->getConfig()->addComponent($component = new GridFieldAddExistingSearchButton()); $fields->addFieldToTab('Root.Main', $grid);
Requirements
Credits
- milkyway-multimedia: Original code
- ajshort: He did most of the coding of GridFieldExtensions, which I borrowed for the more complex versions in this module
- silverstripe-australia: They now look after the GridFieldExtensions module, and have done some updates which I have probably borrowed
License
- MIT
统计信息
- 总下载量: 305
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-11-15