sortablegridfield/README.md

28 lines
847 B
Markdown
Raw Normal View History

2012-05-09 19:13:49 +02:00
SortableGridField
=================
2012-05-09 19:31:28 +02:00
Adds drag and drop functionality to SilverStripe 3.0's GridField
## Usage
2012-05-09 19:39:14 +02:00
To enable sorting on a data object add one of the following you your sites _config.php
2012-05-09 19:31:28 +02:00
*mysite/_config.php*
2012-05-09 19:39:14 +02:00
:::php
GridFieldSortableObject::add_sortable_class('{ClassName}'); //For has_many relationships
GridFieldSortableObject::add_sortable_many_many_relation('{Owner ClassName}', '{Component Name}'); //For many_many relationships
To enable sorting on the grid field add the following to your grid field's config
2012-05-09 19:31:28 +02:00
*Grid Field Config*
2012-05-09 19:39:14 +02:00
:::php
$myGridConfig->addComponent(new GridFieldSortableRows());
2012-05-09 19:31:28 +02:00
## Known Isuses
* Many_many relationship is largely untested and may not work as expected
## Credits
GridFieldSortableObject is based off of dataobject_manager's SortableDataObject class by @unclecheese