mirror of
https://github.com/UndefinedOffset/SortableGridField.git
synced 2024-10-22 17:05:38 +02:00
Merge 1.0.x into master (#112)
* Fixed travis build failure related to phpunit/php-file-iterator * DOCS Update docs examples to be 3.1+ relevant (#111)
This commit is contained in:
parent
8254ce7fe7
commit
d8c379879f
@ -20,7 +20,7 @@ before_script:
|
|||||||
- composer self-update || true
|
- composer self-update || true
|
||||||
- phpenv rehash
|
- phpenv rehash
|
||||||
- phpenv config-rm xdebug.ini
|
- phpenv config-rm xdebug.ini
|
||||||
|
|
||||||
# Install composer dependencies
|
# Install composer dependencies
|
||||||
- composer validate
|
- composer validate
|
||||||
- composer require --no-update silverstripe/recipe-core:^1.0
|
- composer require --no-update silverstripe/recipe-core:^1.0
|
||||||
|
100
README.md
100
README.md
@ -1,10 +1,12 @@
|
|||||||
SortableGridField
|
SortableGridField
|
||||||
=================
|
=================
|
||||||
|
|
||||||
[![Build Status](https://travis-ci.org/UndefinedOffset/SortableGridField.png)](https://travis-ci.org/UndefinedOffset/SortableGridField) ![helpfulrobot](https://helpfulrobot.io/undefinedoffset/sortablegridfield/badge)
|
[![Build Status](https://travis-ci.org/UndefinedOffset/SortableGridField.png)](https://travis-ci.org/UndefinedOffset/SortableGridField) ![helpfulrobot](https://helpfulrobot.io/undefinedoffset/sortablegridfield/badge)
|
||||||
|
|
||||||
Adds drag and drop functionality to SilverStripe 4's GridField
|
Adds drag and drop functionality to SilverStripe 4's GridField
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
* SilverStripe 4.x
|
* SilverStripe 4.x
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
@ -15,12 +17,22 @@ Installation is supported via composer only
|
|||||||
composer require undefinedoffset/sortablegridfield
|
composer require undefinedoffset/sortablegridfield
|
||||||
```
|
```
|
||||||
|
|
||||||
* Run dev/build?flush=all to regenerate the manifest
|
* Run `dev/build?flush=all` to regenerate the manifest
|
||||||
* Upon entering the cms and using GridFieldSortableRows component for the first time you make need to add ?flush=all to the end of the address to force the templates to regenerate
|
* Upon entering the cms and using `GridFieldSortableRows` component for the first time you make need to add `?flush=all`
|
||||||
|
to the end of the address to force the templates to regenerate
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
To enable sorting on a has_many relationship set up an integer field on your data object. Also for has_many relationships make sure to set the $default_sort on the dataobject to this new integer field to ensure that the sort order is applied when the relationship is requested. For many_many relationships you must add a $many_many_extraFields static to the data object defining the relationship, see the SilverStripe documentation for more information on this. If you are using a many_many relationship you will need to do a custom getter to set the sort order of this relationship for use on the front end see below for an example. As well for many_many relationships the name of the GridField *must* be the same as the relationship name other wise error's will occur. For new DataObjects you do not need to increment the Sort order yourself in your DataObject GridFieldSortableRows will automatically do this the next time the grid is displayed.
|
|
||||||
|
To enable sorting on a `has_many` relationship set up an integer field on your data object. Also for `has_many`
|
||||||
|
relationships make sure to set the `$default_sort` on the `DataObject` to this new integer field to ensure that the sort
|
||||||
|
order is applied when the relationship is requested. For `many_many` relationships you must add a
|
||||||
|
`$many_many_extraFields` static to the `DataObject` defining the relationship, see the
|
||||||
|
[SilverStripe documentation](https://docs.silverstripe.org/en/3/developer_guides/model/relations/#many-many)
|
||||||
|
for more information on this. If you are using a `many_many` relationship you will need to do a custom getter to set the
|
||||||
|
sort order of this relationship for use on the front end see below for an example. As well for `many_many` relationships
|
||||||
|
the name of the GridField *must* be the same as the relationship name other wise error's will occur. For new
|
||||||
|
`DataObject`s you do not need to increment the sort order yourself in your `DataObject`, `GridFieldSortableRows` will
|
||||||
|
automatically do this the next time the grid is displayed.
|
||||||
|
|
||||||
```php
|
```php
|
||||||
public function getMyManyManyRelationship() {
|
public function getMyManyManyRelationship() {
|
||||||
@ -28,60 +40,93 @@ public function getMyManyManyRelationship() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To enable drag and drop sorting on the `GridField` add the following to your `GridField`'s config, also make sure you add
|
||||||
To enable drag and drop sorting on the grid field add the following to your grid field's config, also make sure you add the namespace ``UndefinedOffset\SortableGridField\Forms`` to your file.
|
the namespace `UndefinedOffset\SortableGridField\Forms` to your file.
|
||||||
|
|
||||||
```php
|
```php
|
||||||
use UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows; //Namespaces should be added to the top of your file
|
//Namespace imports should be added to the top of your file
|
||||||
|
use UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows;
|
||||||
|
|
||||||
$myGridConfig->addComponent(new GridFieldSortableRows('{Column to store sort}'));
|
$myGridConfig->addComponent(new GridFieldSortableRows('{Column to store sort}'));
|
||||||
```
|
```
|
||||||
|
|
||||||
To move an item to another page drag the row over the respective move to page button which appear on the left and right of the GridField and release.
|
To move an item to another page drag the row over the respective move to page button which appear on the left and right
|
||||||
|
of the GridField and release.
|
||||||
|
|
||||||
#### Full code Examples
|
#### Full code Examples
|
||||||
|
|
||||||
* [has_many relationship](https://github.com/UndefinedOffset/SortableGridField/blob/master/docs/HasManyExample.md)
|
* [has_many relationship](https://github.com/UndefinedOffset/SortableGridField/blob/master/docs/HasManyExample.md)
|
||||||
* [many_many relationship](https://github.com/UndefinedOffset/SortableGridField/blob/master/docs/ManyManyExample.md)
|
* [many_many relationship](https://github.com/UndefinedOffset/SortableGridField/blob/master/docs/ManyManyExample.md)
|
||||||
* [ModelAdmin implementation](https://github.com/UndefinedOffset/SortableGridField/blob/master/docs/ModelAdminExample.md)
|
* [ModelAdmin implementation](https://github.com/UndefinedOffset/SortableGridField/blob/master/docs/ModelAdminExample.md)
|
||||||
|
|
||||||
#### Events
|
#### Events
|
||||||
GridFieldSortableRows provides 4 "events" onBeforeGridFieldRowSort(), onAfterGridFieldRowSort(), onBeforeGridFieldPageSort() and onAfterGridFieldPageSort(). These "events" are passed a clone of the DataList used in GridFieldSortableRows, in the case of page sorting this list has a limit that shows you the current page plus/minus one object. For GridFieldSortableRows that are on ModelAdmin decendents these events are called on the ModelAdmin if they do not have a owner DataObject, if you are using GridFieldSortableRows on a GridField for a DataObject's relationship the events are called on that DataObject.
|
|
||||||
|
`GridFieldSortableRows` provides 4 "events" `onBeforeGridFieldRowSort()`, `onAfterGridFieldRowSort()`,
|
||||||
|
`onBeforeGridFieldPageSort()` and `onAfterGridFieldPageSort()`. These "events" are passed a clone of the `DataList`
|
||||||
|
used in `GridFieldSortableRows`, in the case of page sorting this list has a limit that shows you the current page
|
||||||
|
plus/minus one object. For `GridFieldSortableRows` that are on `ModelAdmin` descendants these events are called on the
|
||||||
|
`ModelAdmin` if they do not have an owner `DataObject`, if you are using `GridFieldSortableRows` on a `GridField` for a
|
||||||
|
`DataObject`'s relationship the events are called on that `DataObject`.
|
||||||
|
|
||||||
#### Appending to the top instead of the bottom
|
#### Appending to the top instead of the bottom
|
||||||
By default GridFieldSortableRows appends to the bottom of the list for performance on large data sets, however you can set new records to append new records to the top by calling setAppendToTop(true) on your GridFieldSortableRows instance.
|
|
||||||
```php
|
|
||||||
use UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows; //Namespaces should be added to the top of your file
|
|
||||||
|
|
||||||
$myGridConfig->addComponent($sortable=new GridFieldSortableRows('SortOrder'));
|
By default `GridFieldSortableRows` appends to the bottom of the list for performance on large data sets, however you can
|
||||||
|
set new records to append new records to the top by calling `setAppendToTop(true)` on your `GridFieldSortableRows`
|
||||||
|
instance.
|
||||||
|
|
||||||
|
```php
|
||||||
|
//Namespace imports should be added to the top of your file
|
||||||
|
use UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows;
|
||||||
|
|
||||||
|
$myGridConfig->addComponent($sortable = new GridFieldSortableRows('SortOrder'));
|
||||||
$sortable->setAppendToTop(true);
|
$sortable->setAppendToTop(true);
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Working with versioned records
|
#### Working with versioned records
|
||||||
By default GridFieldSortableRows does not update any other stage for versioned than the base stage. However you can enable this by calling setUpdateVersionedStage() and passing in the name of the stage you want to update along with the base stage. For example passing in "Live" will also update the "Live" stage when any sort happens.
|
|
||||||
```php
|
|
||||||
use UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows; //Namespaces should be added to the top of your file
|
|
||||||
|
|
||||||
$myGridConfig->addComponent($sortable=new GridFieldSortableRows('SortOrder'));
|
By default `GridFieldSortableRows` does not update any other stage for versioned than the base stage. However you can
|
||||||
|
enable this by calling `setUpdateVersionedStage()` and passing in the name of the stage you want to update along with
|
||||||
|
the base stage. For example passing in "Live" will also update the "Live" stage when any sort happens.
|
||||||
|
|
||||||
|
```php
|
||||||
|
//Namespace imports should be added to the top of your file
|
||||||
|
use UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows;
|
||||||
|
|
||||||
|
$myGridConfig->addComponent($sortable = new GridFieldSortableRows('SortOrder'));
|
||||||
$sortable->setUpdateVersionedStage('Live');
|
$sortable->setUpdateVersionedStage('Live');
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Overriding the default relationship name
|
#### Overriding the default relationship name
|
||||||
By default the relationship name comes from the name of the GridField, however you can override this lookup by calling setCustomRelationName() and passing in the name of the relationship. This allows for you to have multiple GridFields on the same form interacting with the same many_many list maybe filtered slightly differently.
|
|
||||||
|
By default the relationship name comes from the name of the `GridField`, however you can override this lookup by
|
||||||
|
calling `setCustomRelationName()` and passing in the name of the relationship. This allows for you to have multiple
|
||||||
|
`GridFields` on the same form interacting with the same `many_many` list maybe filtered slightly differently.
|
||||||
|
|
||||||
```php
|
```php
|
||||||
use UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows; //Namespaces should be added to the top of your file
|
//Namespace imports should be added to the top of your file
|
||||||
|
use UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows;
|
||||||
|
|
||||||
$myGridConfig->addComponent($sortable=new GridFieldSortableRows('SortOrder'));
|
$myGridConfig->addComponent($sortable = new GridFieldSortableRows('SortOrder'));
|
||||||
$sortable->setCustomRelationName('MyRelationship');
|
$sortable->setCustomRelationName('MyRelationship');
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Reporting an issue
|
## Reporting an issue
|
||||||
When you're reporting an issue please ensure you specify what version of SilverStripe you are using i.e. 3.0.5, 3.1beta3, 3.0-master etc. Also be sure to include any JavaScript or PHP errors you receive, for PHP errors please ensure you include the full stack trace. Also please include your implementation code (where your setting up your grid field) as well as how you produced the issue. You may also be asked to provide some of the classes to aid in re-producing the issue. Stick with the issue, remember that you seen the issue not the maintainer of the module so it may take allot of questions to arrive at a fix or answer.
|
|
||||||
|
When you're reporting an issue please ensure you specify what version of SilverStripe you are using i.e. 3.0.5,
|
||||||
|
3.1beta3, 3.0-master etc. Also be sure to include any JavaScript or PHP errors you receive, for PHP errors please ensure
|
||||||
|
you include the full stack trace. Also please include your implementation code (where your setting up your grid field)
|
||||||
|
as well as how you produced the issue. You may also be asked to provide some of the classes to aid in re-producing the
|
||||||
|
issue. Stick with the issue, remember that you seen the issue not the maintainer of the module so it may take a lot of
|
||||||
|
questions to arrive at a fix or answer.
|
||||||
|
|
||||||
### Notes
|
### Notes
|
||||||
* When using with GridFieldManyRelationHandler make sure that you add GridFieldSortableRows to your config before for example GridFieldManyRelationHandler:
|
|
||||||
|
* When using with GridFieldManyRelationHandler make sure that you add GridFieldSortableRows to your config before for
|
||||||
|
example `GridFieldManyRelationHandler`:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
use UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows; //Namespaces should be added to the top of your file
|
//Namespace imports should be added to the top of your file
|
||||||
|
use UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows;
|
||||||
|
|
||||||
$config->addComponent(new GridFieldSortableRows('SortOrder'), 'GridFieldManyRelationHandler');
|
$config->addComponent(new GridFieldSortableRows('SortOrder'), 'GridFieldManyRelationHandler');
|
||||||
```
|
```
|
||||||
@ -90,6 +135,9 @@ $config->addComponent(new GridFieldSortableRows('SortOrder'), 'GridFieldManyRela
|
|||||||
|
|
||||||
### Translations
|
### Translations
|
||||||
|
|
||||||
Translations of the natural language strings are managed through a third party translation interface, transifex.com. Newly added strings will be periodically uploaded there for translation, and any new translations will be merged back to the project source code.
|
Translations of the natural language strings are managed through a third party translation interface, transifex.com.
|
||||||
|
Newly added strings will be periodically uploaded there for translation, and any new translations will be merged back to
|
||||||
|
the project source code.
|
||||||
|
|
||||||
Please use [https://www.transifex.com/projects/p/silverstripe-sortablegridfield](https://www.transifex.com/projects/p/silverstripe-sortablegridfield) to contribute translations, rather than sending pull requests with YAML files.
|
Please use [https://www.transifex.com/projects/p/silverstripe-sortablegridfield](https://www.transifex.com/projects/p/silverstripe-sortablegridfield)
|
||||||
|
to contribute translations, rather than sending pull requests with YAML files.
|
||||||
|
@ -1,20 +1,23 @@
|
|||||||
has_many Example
|
has_many Example
|
||||||
=================
|
=================
|
||||||
|
|
||||||
```php
|
```php
|
||||||
/*** TestPage.php ***/
|
/*** TestPage.php ***/
|
||||||
use SilverStripe\Forms\GridField\GridField;
|
use SilverStripe\Forms\GridField\GridField;
|
||||||
use SilverStripe\Forms\GridField\GridFieldConfig_RecordEditor;
|
use SilverStripe\Forms\GridField\GridFieldConfig_RecordEditor;
|
||||||
use UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows;
|
use UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows;
|
||||||
|
|
||||||
class TestPage extends Page {
|
class TestPage extends Page
|
||||||
private static $has_many=array(
|
{
|
||||||
'TestObjects'=>'TestObject'
|
private static $has_many = [
|
||||||
);
|
'TestObjects' => 'TestObject',
|
||||||
|
];
|
||||||
|
|
||||||
public function getCMSFields() {
|
public function getCMSFields()
|
||||||
$fields=parent::getCMSFields();
|
{
|
||||||
|
$fields = parent::getCMSFields();
|
||||||
$conf=GridFieldConfig_RecordEditor::create(10);
|
|
||||||
|
$conf = GridFieldConfig_RecordEditor::create(10);
|
||||||
$conf->addComponent(new GridFieldSortableRows('SortOrder'));
|
$conf->addComponent(new GridFieldSortableRows('SortOrder'));
|
||||||
|
|
||||||
$fields->addFieldToTab('Root.TestObjects', new GridField('TestObjects', 'TestObjects', $this->TestObjects(), $conf));
|
$fields->addFieldToTab('Root.TestObjects', new GridField('TestObjects', 'TestObjects', $this->TestObjects(), $conf));
|
||||||
@ -27,16 +30,17 @@ class TestPage extends Page {
|
|||||||
/*** TestObject.php ***/
|
/*** TestObject.php ***/
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
class TestObject extends DataObject {
|
class TestObject extends DataObject
|
||||||
private static $db=array(
|
{
|
||||||
'Title'=>'Text',
|
private static $db = [
|
||||||
'SortOrder'=>'Int'
|
'Title' => 'Text',
|
||||||
);
|
'SortOrder' => 'Int',
|
||||||
|
];
|
||||||
|
|
||||||
private static $has_one=array(
|
private static $has_one = [
|
||||||
'Parent'=>'TestPage'
|
'Parent' => 'TestPage',
|
||||||
);
|
];
|
||||||
|
|
||||||
private static $default_sort='SortOrder';
|
private static $default_sort = 'SortOrder';
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -1,27 +1,30 @@
|
|||||||
many_many Example
|
many_many Example
|
||||||
=================
|
=================
|
||||||
|
|
||||||
```php
|
```php
|
||||||
/*** TestPage.php ***/
|
/*** TestPage.php ***/
|
||||||
use SilverStripe\Forms\GridField\GridField;
|
use SilverStripe\Forms\GridField\GridField;
|
||||||
use SilverStripe\Forms\GridField\GridFieldConfig_RelationEditor;
|
use SilverStripe\Forms\GridField\GridFieldConfig_RelationEditor;
|
||||||
use UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows;
|
use UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows;
|
||||||
|
|
||||||
class TestPage extends Page {
|
class TestPage extends Page
|
||||||
private static $many_many=array(
|
{
|
||||||
'TestObjects'=>'TestObject'
|
private static $many_many = [
|
||||||
);
|
'TestObjects' => 'TestObject',
|
||||||
|
];
|
||||||
|
|
||||||
private static $many_many_extraFields=array(
|
private static $many_many_extraFields = [
|
||||||
'TestObjects'=>array(
|
'TestObjects' => [
|
||||||
'SortOrder'=>'Int'
|
'SortOrder' => 'Int',
|
||||||
)
|
]
|
||||||
);
|
];
|
||||||
|
|
||||||
|
|
||||||
public function getCMSFields() {
|
public function getCMSFields()
|
||||||
$fields=parent::getCMSFields();
|
{
|
||||||
|
$fields = parent::getCMSFields();
|
||||||
|
|
||||||
$conf=GridFieldConfig_RelationEditor::create(10);
|
$conf = GridFieldConfig_RelationEditor::create(10);
|
||||||
$conf->addComponent(new GridFieldSortableRows('SortOrder'));
|
$conf->addComponent(new GridFieldSortableRows('SortOrder'));
|
||||||
|
|
||||||
$fields->addFieldToTab('Root.TestObjects', new GridField('TestObjects', 'TestObjects', $this->TestObjects(), $conf));
|
$fields->addFieldToTab('Root.TestObjects', new GridField('TestObjects', 'TestObjects', $this->TestObjects(), $conf));
|
||||||
@ -29,7 +32,8 @@ class TestPage extends Page {
|
|||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function TestObjects() {
|
public function TestObjects()
|
||||||
|
{
|
||||||
return $this->getManyManyComponents('TestObjects')->sort('SortOrder');
|
return $this->getManyManyComponents('TestObjects')->sort('SortOrder');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,13 +42,14 @@ class TestPage extends Page {
|
|||||||
/*** TestObject.php ***/
|
/*** TestObject.php ***/
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
class TestObject extends DataObject {
|
class TestObject extends DataObject
|
||||||
private static $db=array(
|
{
|
||||||
'Title'=>'Text'
|
private static $db = [
|
||||||
);
|
'Title' => 'Text',
|
||||||
|
];
|
||||||
|
|
||||||
private static $belongs_many_many=array(
|
private static $belongs_many_many = [
|
||||||
'TestPages'=>'TestPage'
|
'TestPages' => 'TestPage',
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -1,24 +1,28 @@
|
|||||||
ModelAdmin implementation Example
|
ModelAdmin implementation Example
|
||||||
=================
|
=================
|
||||||
|
|
||||||
```php
|
```php
|
||||||
/**** MyModelAdmin.php ****/
|
/**** MyModelAdmin.php ****/
|
||||||
use SilverStripe\Admin\ModelAdmin;
|
use SilverStripe\Admin\ModelAdmin;
|
||||||
use SilverStripe\Forms\GridField\GridField;
|
use SilverStripe\Forms\GridField\GridField;
|
||||||
use UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows;
|
use UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows;
|
||||||
|
|
||||||
class MyModelAdmin extends ModelAdmin {
|
class MyModelAdmin extends ModelAdmin
|
||||||
private static $menu_title='My Model Admin';
|
{
|
||||||
private static $url_segment='my-model-admin';
|
private static $menu_title = 'My Model Admin';
|
||||||
|
|
||||||
private static $managed_models=array(
|
private static $url_segment = 'my-model-admin';
|
||||||
'MATestObject'
|
|
||||||
);
|
private static $managed_models = [
|
||||||
|
'MATestObject',
|
||||||
public function getEditForm($id = null, $fields = null) {
|
];
|
||||||
$form=parent::getEditForm($id, $fields);
|
|
||||||
|
public function getEditForm($id = null, $fields = null)
|
||||||
|
{
|
||||||
|
$form = parent::getEditForm($id, $fields);
|
||||||
|
|
||||||
//This check is simply to ensure you are on the managed model you want adjust accordingly
|
//This check is simply to ensure you are on the managed model you want adjust accordingly
|
||||||
if($this->modelClass=='MATestObject' && $gridField=$form->Fields()->dataFieldByName($this->sanitiseClassName($this->modelClass))) {
|
if($this->modelClass == 'MATestObject' && $gridField = $form->Fields()->dataFieldByName($this->sanitiseClassName($this->modelClass))) {
|
||||||
//This is just a precaution to ensure we got a GridField from dataFieldByName() which you should have
|
//This is just a precaution to ensure we got a GridField from dataFieldByName() which you should have
|
||||||
if($gridField instanceof GridField) {
|
if($gridField instanceof GridField) {
|
||||||
$gridField->getConfig()->addComponent(new GridFieldSortableRows('SortOrder'));
|
$gridField->getConfig()->addComponent(new GridFieldSortableRows('SortOrder'));
|
||||||
@ -32,12 +36,13 @@ class MyModelAdmin extends ModelAdmin {
|
|||||||
/**** MATestObject.php ****/
|
/**** MATestObject.php ****/
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
class MATestObject extends DataObject {
|
class MATestObject extends DataObject
|
||||||
private static $db=array(
|
{
|
||||||
'Title'=>'Varchar',
|
private static $db = [
|
||||||
'SortOrder'=>'Int'
|
'Title' => 'Varchar',
|
||||||
);
|
'SortOrder' => 'Int',
|
||||||
|
];
|
||||||
|
|
||||||
private static $default_sort='SortOrder';
|
private static $default_sort = 'SortOrder';
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user