Symbiote\GridFieldExtensions\GridFieldOrderableRows
Allows grid field rows to be re-ordered via drag and drop. Both normal data lists and many many lists can be ordered.
If the grid field has not been sorted, this component will sort the data by
the sort field.
Synopsis
class GridFieldOrderableRows
extends RequestHandler
implements
GridField_ColumnProvider,GridField_DataManipulator,GridField_HTMLProvider,GridField_URLHandler,GridField_SaveHandler
{
- // members
- private static boolean $default_immediate_update = true;
- private static array $allowed_actions = ;
- protected $sortField;
- protected $immediateUpdate;
- protected string|array $extraSortFields = NULL;
- protected integer $reorderColumnNumber = 0;
- // methods
- public void __construct()
- public string getSortField()
- public GridFieldOrderableRows setSortField()
- public boolean getImmediateUpdate()
- public GridFieldOrderableRows setImmediateUpdate()
- public string|array getExtraSortFields()
- protected bool isManyMany()
- public GridFieldOrderableRows setExtraSortFields()
- public int getReorderColumnNumber()
- public GridFieldOrderableRows setReorderColumnNumber()
- public void validateSortField()
- public string getSortTable()
- public void getURLHandlers()
- public void getHTMLFragments()
- public void augmentColumns()
- public void getColumnsHandled()
- public void getColumnContent()
- public void getColumnAttributes()
- public void getColumnMetadata()
- public void getManipulatedData()
- public string handleReorder()
- protected array getSortedIDs()
- public void handleMoveToPage()
- public void handleSave()
- protected bool executeReorder()
- protected void reorderItems()
- protected void populateSortValues()
- protected string getSortTableClauseForIds()
- protected ManyManyList|ManyManyThroughQueryManipulator getManyManyInspector()
- private string getManyManyInspectorForeignKey()
- protected array getSortValuesFromManyManyThroughList()
Hierarchy
Extends
- SilverStripe\Control\RequestHandler
Implements
- SilverStripe\Forms\GridField\GridField_ColumnProvider
- SilverStripe\Forms\GridField\GridField_DataManipulator
- SilverStripe\Forms\GridField\GridField_HTMLProvider
- SilverStripe\Forms\GridField\GridField_URLHandler
- SilverStripe\Forms\GridField\GridField_SaveHandler
Members
private
- $allowed_actions
- $default_immediate_update — boolean
protected
- $extraSortFields
—
Symbiote\GridFieldExtensions\string|array
Extra sort fields to apply before the sort field. - $immediateUpdate
—
boolean
If set to true, when an item is re-ordered, it will update on the database and refresh the gridfield. When set to false, it will only update the sort order when the record is saved. - $reorderColumnNumber
—
int
The number of the column containing the reorder handles - $sortField
—
string
The database field which specifies the sort, defaults to "Sort".
Methods
private
- getManyManyInspectorForeignKey() — Depending on the list inspector and the list itself (ManyMany vs ManyManyThrough), the method to obtain the foreign key may be different.
protected
- executeReorder()
- getManyManyInspector() — A ManyManyList defines functions such as getLocalKey, however on ManyManyThroughList these functions are moved to ManyManyThroughQueryManipulator, but otherwise retain the same signature.
- getSortTableClauseForIds() — Forms a WHERE clause for the table the sort column is defined on.
- getSortValuesFromManyManyThroughList() — Used to get sort orders from a many many through list relationship record, rather than the current record itself.
- getSortedIDs() — Get mapping of sort value to item ID from posted data (gridfield list state), ordered by sort value.
- isManyMany() — Checks to see if the relationship list is for a type of many_many
- populateSortValues()
- reorderItems()
public
- __construct()
- augmentColumns()
- getColumnAttributes()
- getColumnContent()
- getColumnMetadata()
- getColumnsHandled()
- getExtraSortFields()
- getHTMLFragments()
- getImmediateUpdate()
- getManipulatedData()
- getReorderColumnNumber()
- getSortField()
- getSortTable() — Gets the table which contains the sort field.
- getURLHandlers()
- handleMoveToPage() — Handles requests to move an item to the previous or next page.
- handleReorder() — Handles requests to reorder a set of IDs in a specific order.
- handleSave() — Handle saving when 'immediateUpdate' is disabled, otherwise this isn't necessary for the default sort mode.
- setExtraSortFields() — Sets extra sort fields to apply before the sort field.
- setImmediateUpdate()
- setReorderColumnNumber() — Sets the number of the column containing the reorder handles.
- setSortField() — Sets the field used to specify the sort.
- validateSortField() — Validates sortable list