When using the GridFieldManyRelationHandler module https://github.com/simonwelsh/silverstripe-GridFieldRelationHandler on the same GridField, GridFieldSortableRows::fixSortColumn breaks on line 134.
ERROR [User Error]: Sort column SortOrder could not be found in Biography's ancestry.
The problem is occuring because the list being passed in is a DataList and not a ManyManyList, even though it Should be a ManyManyList.
I"m not really sure if this is a problem in SortableGridField or in GridFieldManyRelationHandler, but the error is occuring in code in SortableGridField so I thought I'd start here.
Relevant Code:
$config->addComponent( new GridFieldSortableRows('SortOrder') );
$config->addComponent( new GridFieldManyRelationHandler(), 'GridFieldPaginator' );
Error Report
ERROR [User Error]: Sort column SortOrder could not be found in Biography's ancestry
IN POST /admin/pages/edit/EditForm/field/Biographies
Line 133 in C:\wamp\www\snwp_v31\SortableGridField\code\forms\GridFieldSortableRows.php
Source
======
124: $query->limit(array());
125: return $query;
126: });
127: $many_many = ($list instanceof ManyManyList);
128: if (!$many_many) {
129: $sng=singleton($gridField->getModelClass());
130: $fieldType=$sng->db($this->sortColumn);
131: if(!$fieldType || !($fieldType=='Int' || is_subclass_of('Int', $fieldType))) {
132: if(is_array($fieldType)) {
* 133: user_error('Sort column '.$this->sortColumn.' could not be found in
'.$gridField->getModelClass().'\'s ancestry', E_USER_ERROR);
134: }else {
135: user_error('Sort column '.$this->sortColumn.' must be an Int, column is of type '.$fieldType,
E_USER_ERROR);
136: }
137:
138: exit;
139: }
Trace
=====
user_error(Sort column SortOrder could not be found in Biography's ancestry,256)
GridFieldSortableRows.php:133
GridFieldSortableRows->fixSortColumn(GridField,DataList)
GridFieldSortableRows.php:95
GridFieldSortableRows->getManipulatedData(GridField,DataList)
GridField.php:222
GridField->getManipulatedList()
GridField.php:264
GridField->FieldHolder()
GridField.php:644
GridField->gridFieldAlterAction(Array,Form,SS_HTTPRequest)
GridField.php:108
GridField->index(SS_HTTPRequest)
RequestHandler.php:278
RequestHandler->handleAction(SS_HTTPRequest,index)
RequestHandler.php:190
RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
GridField.php:749
GridField->handleRequest(SS_HTTPRequest,DataModel)
RequestHandler.php:212
RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
RequestHandler.php:212
RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
Controller.php:153
Controller->handleRequest(SS_HTTPRequest,DataModel)
LeftAndMain.php:438
LeftAndMain->handleRequest(SS_HTTPRequest,DataModel)
AdminRootController.php:89
AdminRootController->handleRequest(SS_HTTPRequest,DataModel)
Director.php:325
Director::handleRequest(SS_HTTPRequest,Session,DataModel)
Director.php:143
Director::direct(/admin/pages/edit/EditForm/field/Biographies,DataModel)
main.php:128
When using the GridFieldManyRelationHandler module https://github.com/simonwelsh/silverstripe-GridFieldRelationHandler on the same GridField, GridFieldSortableRows::fixSortColumn breaks on line 134.
ERROR [User Error]: Sort column SortOrder could not be found in Biography's ancestry.
The problem is occuring because the list being passed in is a DataList and not a ManyManyList, even though it Should be a ManyManyList.
I"m not really sure if this is a problem in SortableGridField or in GridFieldManyRelationHandler, but the error is occuring in code in SortableGridField so I thought I'd start here.
Relevant Code:
Error Report