class GridFieldSortableRows implements GridField_HTMLProvider, GridField_ActionProvider, GridField_DataManipulator (View source)

This component provides a checkbox which when checked enables drag-and-drop re-ordering of elements displayed in a GridField

Properties

protected string $sortColumn
protected bool $disable_selection
protected bool $append_to_top
protected null|string $update_versioned_stage
protected null|string $custom_relation_name

Methods

public
__construct(string $sortColumn, bool $disableSelection = true, string $updateVersionStage = null, string $customRelationName = null)

No description

public
array
getHTMLFragments(GridField $gridField)

Returns a map where the keys are fragment names and the values are pieces of HTML to add to these fragments.

public
getManipulatedData(GridField $gridField, SS_List $dataList)

Manipulate the datalist as needed by this grid modifier.

public
setAppendToTop(bool $value)

Sets if new records should be appended to the top or the bottom of the list

public
setDisableSelection(bool $value)

No description

public
setUpdateVersionedStage(string $value)

Sets the suffix of the versioned stage that should be updated along side the default stage

public
setCustomRelationName(string $value)

Sets the name of the relationship to use, by default the name is determined from the GridField's name

protected
fixSortColumn(GridField $gridField, SS_List $dataList)

Detects and corrects items with a sort column value of 0, by appending them to the bottom of the list

public
array
getActions(GridField $gridField)

Return a list of the actions handled by this action provider.

public
handleAction(GridField $gridField, string $actionName, array $arguments, array $data)

Handle an action on the given grid field.

protected
saveGridRowSort(GridField $gridField, array $data)

Handles saving of the row sort order

protected
sortToPage(GridField $gridField, array $data)

Handles sorting across pages

public
bool
hasVersionedExtension(Extensible|string $className)

Check to see if the given class name has the Versioned extension

public
string
mapTableNameAndReturn($className) deprecated

Checks to see if $table_name is declared on the DataObject, if not returns string as given

Details

__construct(string $sortColumn, bool $disableSelection = true, string $updateVersionStage = null, string $customRelationName = null)

No description

Parameters

string $sortColumn

Column that should be used to update the sort information

bool $disableSelection

Disable selection on the GridField when dragging

string $updateVersionStage

Name of the versioned stage to update this disabled by default unless this is set

string $customRelationName

Name of the relationship to use, if left null the name is determined from the GridField's name

array getHTMLFragments(GridField $gridField)

Returns a map where the keys are fragment names and the values are pieces of HTML to add to these fragments.

Parameters

GridField $gridField

Return Value

array

SS_List getManipulatedData(GridField $gridField, SS_List $dataList)

Manipulate the datalist as needed by this grid modifier.

Parameters

GridField $gridField
SS_List $dataList

Return Value

SS_List

GridFieldSortableRows setAppendToTop(bool $value)

Sets if new records should be appended to the top or the bottom of the list

Parameters

bool $value

Boolean true to append to the top false to append to the bottom

Return Value

GridFieldSortableRows

Returns the current instance

GridFieldSortableRows setDisableSelection(bool $value)

No description

Parameters

bool $value

Boolean true to disable selection of table contents false to enable selection

Return Value

GridFieldSortableRows

Returns the current instance

GridFieldSortableRows setUpdateVersionedStage(string $value)

Sets the suffix of the versioned stage that should be updated along side the default stage

Parameters

string $value

Versioned Stage to update this is disabled by default unless this is set

Return Value

GridFieldSortableRows

Returns the current instance

GridFieldSortableRows setCustomRelationName(string $value)

Sets the name of the relationship to use, by default the name is determined from the GridField's name

Parameters

string $value

Name of the relationship to use, by default the name is determined from the GridField's name

Return Value

GridFieldSortableRows

Returns the current instance

protected fixSortColumn(GridField $gridField, SS_List $dataList)

Detects and corrects items with a sort column value of 0, by appending them to the bottom of the list

Parameters

GridField $gridField

Grid Field Reference

SS_List $dataList

Data List of items to be checked

array getActions(GridField $gridField)

Return a list of the actions handled by this action provider.

Parameters

GridField $gridField

Return Value

array

with action identifier strings.

handleAction(GridField $gridField, string $actionName, array $arguments, array $data)

Handle an action on the given grid field.

Parameters

GridField $gridField
string $actionName

Action identifier, see getActions().

array $arguments

Arguments relevant for this

array $data

All form data

protected saveGridRowSort(GridField $gridField, array $data)

Handles saving of the row sort order

Parameters

GridField $gridField

Grid Field Reference

array $data

Data submitted in the request

Exceptions

ValidationException

protected sortToPage(GridField $gridField, array $data)

Handles sorting across pages

Parameters

GridField $gridField

Grid Field Reference

array $data

Data submitted in the request

bool hasVersionedExtension(Extensible|string $className)

Check to see if the given class name has the Versioned extension

Parameters

Extensible|string $className

Return Value

bool

string mapTableNameAndReturn($className) deprecated

deprecated Use DataObject::getSchema()->tableName() instead

Checks to see if $table_name is declared on the DataObject, if not returns string as given

Parameters

$className

Return Value

string