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 $sortColumn
protected $disable_selection
protected $append_to_top
protected $update_versioned_stage
protected $custom_relation_name

Methods

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

No description

public
array
getHTMLFragments($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)

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

public
handleAction(GridField $gridField, $actionName, $arguments, $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

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)

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

Parameters

$gridField

Return Value

array

DataList getManipulatedData(GridField $gridField, SS_List $dataList)

Manipulate the datalist as needed by this grid modifier.

Parameters

GridField $gridField
SS_List $dataList

Return Value

DataList

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)

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

Parameters

$gridField

Return Value

array

with action identifier strings.

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

Handle an action on the given grid field.

Parameters

GridField $gridField
$actionName
$arguments
$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

protected sortToPage(GridField $gridField, array $data)

Handles sorting across pages

Parameters

GridField $gridField

Grid Field Reference

array $data

Data submitted in the request