PHP Class GridFieldOrderableRows, silverstripe-gridfieldextensions

If the grid field has not been sorted, this component will sort the data by the sort field.
Inheritance: extends RequestHandler, implements GridField_ColumnProvider, implements GridField_DataManipulator, implements GridField_HTMLProvider, implements GridField_URLHandler
Afficher le fichier Open project: ajshort/silverstripe-gridfieldextensions Class Usage Examples

Protected Properties

Свойство Type Description
$extraSortFields 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 integer The number of the column containing the reorder handles
$sortField string The database field which specifies the sort, defaults to "Sort".

Méthodes publiques

Méthode Description
__construct ( string $sortField = 'Sort' )
augmentColumns ( $grid, &$cols )
getColumnAttributes ( $grid, $record, $col )
getColumnContent ( $grid, $record, $col )
getColumnMetadata ( $grid, $col )
getColumnsHandled ( $grid )
getExtraSortFields ( ) : string | array
getHTMLFragments ( GridField $field )
getImmediateUpdate ( ) : boolean
getManipulatedData ( GridField $grid, SS_List $list )
getReorderColumnNumber ( ) : integer
getSortField ( ) : string
getSortTable ( SS_List $list ) : string Gets the table which contains the sort field.
getURLHandlers ( $grid )
handleMoveToPage ( GridField $grid, $request ) Handles requests to move an item to the previous or next page.
handleReorder ( GridField $grid, SS_HTTPRequest $request ) : SS_HTTPResponse Handles requests to reorder a set of IDs in a specific order.
handleSave ( GridField $grid, DataObjectInterface $record ) Handle saving when 'immediateUpdate' is disabled, otherwise this isn't necessary for the default sort mode.
setExtraSortFields ( string | array $fields ) : GridFieldOrderableRows Sets extra sort fields to apply before the sort field.
setImmediateUpdate ( $bool ) : GridFieldOrderableRows
setReorderColumnNumber ( integer $colno ) : GridFieldOrderableRows Sets the number of the column containing the reorder handles.
setSortField ( $field ) : GridFieldOrderableRows Sets the field used to specify the sort.

Méthodes protégées

Méthode Description
executeReorder ( GridField $grid, array $sortedIDs ) : boolean
getSortTableClauseForIds ( DataList $list, $ids )
getSortedIDs ( array $data ) : array Get mapping of sort value to ID from posted data
populateSortValues ( DataList $list )
reorderItems ( $list, array $values, array $sortedIDs )

Method Details

__construct() public méthode

public __construct ( string $sortField = 'Sort' )
$sortField string

augmentColumns() public méthode

public augmentColumns ( $grid, &$cols )

executeReorder() protected méthode

protected executeReorder ( GridField $grid, array $sortedIDs ) : boolean
$grid GridField
$sortedIDs array List of IDS, where the key is the sort field value to save
Résultat boolean

getColumnAttributes() public méthode

public getColumnAttributes ( $grid, $record, $col )

getColumnContent() public méthode

public getColumnContent ( $grid, $record, $col )

getColumnMetadata() public méthode

public getColumnMetadata ( $grid, $col )

getColumnsHandled() public méthode

public getColumnsHandled ( $grid )

getExtraSortFields() public méthode

public getExtraSortFields ( ) : string | array
Résultat string | array

getHTMLFragments() public méthode

public getHTMLFragments ( GridField $field )
$field GridField

getImmediateUpdate() public méthode

public getImmediateUpdate ( ) : boolean
Résultat boolean

getManipulatedData() public méthode

public getManipulatedData ( GridField $grid, SS_List $list )
$grid GridField
$list SS_List

getReorderColumnNumber() public méthode

public getReorderColumnNumber ( ) : integer
Résultat integer

getSortField() public méthode

public getSortField ( ) : string
Résultat string

getSortTable() public méthode

Gets the table which contains the sort field.
public getSortTable ( SS_List $list ) : string
$list SS_List
Résultat string

getSortTableClauseForIds() protected méthode

protected getSortTableClauseForIds ( DataList $list, $ids )
$list DataList

getSortedIDs() protected méthode

Get mapping of sort value to ID from posted data
protected getSortedIDs ( array $data ) : array
$data array Raw posted data
Résultat array

getURLHandlers() public méthode

public getURLHandlers ( $grid )

handleMoveToPage() public méthode

Handles requests to move an item to the previous or next page.
public handleMoveToPage ( GridField $grid, $request )
$grid GridField

handleReorder() public méthode

Handles requests to reorder a set of IDs in a specific order.
public handleReorder ( GridField $grid, SS_HTTPRequest $request ) : SS_HTTPResponse
$grid GridField
$request SS_HTTPRequest
Résultat SS_HTTPResponse

handleSave() public méthode

Handle saving when 'immediateUpdate' is disabled, otherwise this isn't necessary for the default sort mode.
public handleSave ( GridField $grid, DataObjectInterface $record )
$grid GridField
$record DataObjectInterface

populateSortValues() protected méthode

protected populateSortValues ( DataList $list )
$list DataList

reorderItems() protected méthode

protected reorderItems ( $list, array $values, array $sortedIDs )
$values array
$sortedIDs array

setExtraSortFields() public méthode

Sets extra sort fields to apply before the sort field.
public setExtraSortFields ( string | array $fields ) : GridFieldOrderableRows
$fields string | array
Résultat GridFieldOrderableRows $this

setImmediateUpdate() public méthode

public setImmediateUpdate ( $bool ) : GridFieldOrderableRows
Résultat GridFieldOrderableRows $this

setReorderColumnNumber() public méthode

Sets the number of the column containing the reorder handles.
public setReorderColumnNumber ( integer $colno ) : GridFieldOrderableRows
$colno integer
Résultat GridFieldOrderableRows $this

setSortField() public méthode

Sets the field used to specify the sort.
public setSortField ( $field ) : GridFieldOrderableRows
Résultat GridFieldOrderableRows $this

Property Details

$extraSortFields protected_oe property

Extra sort fields to apply before the sort field.
See also: setExtraSortFields()
protected string|array $extraSortFields
Résultat string | array

$immediateUpdate protected_oe property

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.
protected bool $immediateUpdate
Résultat boolean

$reorderColumnNumber protected_oe property

The number of the column containing the reorder handles
See also: setReorderColumnNumber()
protected int $reorderColumnNumber
Résultat integer

$sortField protected_oe property

The database field which specifies the sort, defaults to "Sort".
See also: setSortField()
protected string $sortField
Résultat string