src/Forms/GridFieldSortableRows.php
public function getManipulatedData(GridField $gridField, SS_List $dataList)
    {
        //Detect and correct items with a sort column value of 0 (push to bottom)
        $this->fixSortColumn($gridField, $dataList);


        $headerState = $gridField->State->GridFieldSortableHeader;
        $state = $gridField->State->GridFieldSortableRows;
        if ((!is_bool($state->sortableToggle) || $state->sortableToggle === false) && $headerState && is_string($headerState->SortColumn) && is_string($headerState->SortDirection)) {
            return $dataList->sort($headerState->SortColumn, $headerState->SortDirection);
        }

        if ($state->sortableToggle === true) {
            $gridField->getConfig()->removeComponentsByType(GridFieldFilterHeader::class);
            $gridField->getConfig()->removeComponentsByType(GridFieldSortableHeader::class);
        }

        return $dataList->sort($this->sortColumn);
    }
public function getManipulatedData(GridField $gridField, SS_List $dataList)
    {
        //Detect and correct items with a sort column value of 0 (push to bottom)
        $this->fixSortColumn($gridField, $dataList);


        $headerState = $gridField->State->GridFieldSortableHeader;
        $state = $gridField->State->GridFieldSortableRows;
        if ((!is_bool($state->sortableToggle) || $state->sortableToggle === false) && $headerState && is_string($headerState->SortColumn) && is_string($headerState->SortDirection)) {
            return $dataList->sort($headerState->SortColumn, $headerState->SortDirection);
        }

        if ($state->sortableToggle === true) {
            $gridField->getConfig()->removeComponentsByType(GridFieldFilterHeader::class);
            $gridField->getConfig()->removeComponentsByType(GridFieldSortableHeader::class);
        }

        return $dataList->sort($this->sortColumn);
    }
public function getManipulatedData ( GridField $ gridField , SS_List $ dataList ) { //Detect and correct items with a sort column value of 0 (push to bottom) $ this -> fixSortColumn ( $ gridField , $ dataList ) ; $ headerState = $ gridField -> State -> GridFieldSortableHeader ; $ state = $ gridField -> State -> GridFieldSortableRows ; if ( ( ! is_bool ( $ state -> sortableToggle ) || $ state -> sortableToggle === false ) && $ headerState && is_string ( $ headerState -> SortColumn ) && is_string ( $ headerState -> SortDirection ) ) { return $ dataList -> sort ( $ headerState -> SortColumn , $ headerState -> SortDirection ) ; } if ( $ state -> sortableToggle === true ) { $ gridField -> getConfig ( ) -> removeComponentsByType ( GridFieldFilterHeader :: class ) ; $ gridField -> getConfig ( ) -> removeComponentsByType ( GridFieldSortableHeader :: class ) ; } return $ dataList -> sort ( $ this -> sortColumn ) ; }
Manipulate the datalist as needed by this grid modifier.
@param GridField $gridField Grid Field Reference
@param SS_List|DataList $dataList Data List to adjust
@return DataList Modified Data List
Manipulate the datalist as needed by this grid modifier .