mirror of
https://github.com/UndefinedOffset/SortableGridField.git
synced 2024-10-22 17:05:38 +02:00
Fixed issue #120 where 'Int' as a datatype would not work
This commit is contained in:
parent
dc11841e11
commit
5e3e5cac3f
@ -1,5 +1,12 @@
|
||||
# Change Log
|
||||
|
||||
## [2.0.4](https://github.com/UndefinedOffset/SortableGridField/tree/2.0.4) (2018-03-07)
|
||||
[Full Changelog](https://github.com/UndefinedOffset/SortableGridField/compare/2.0.3...2.0.4)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Int to DBInt [\#120](https://github.com/UndefinedOffset/SortableGridField/issues/120)
|
||||
|
||||
## [2.0.3](https://github.com/UndefinedOffset/SortableGridField/tree/2.0.3) (2018-03-01)
|
||||
[Full Changelog](https://github.com/UndefinedOffset/SortableGridField/compare/2.0.2...2.0.3)
|
||||
|
||||
|
@ -234,7 +234,7 @@ class GridFieldSortableRows implements GridField_HTMLProvider, GridField_ActionP
|
||||
$sng = singleton($gridField->getModelClass());
|
||||
$fieldType = $sng->config()->db[$this->sortColumn];
|
||||
|
||||
if (!$fieldType || !($fieldType == 'SilverStripe\\ORM\\FieldType\\DBInt' || is_subclass_of($fieldType, 'SilverStripe\\ORM\\FieldType\\DBInt'))) {
|
||||
if (!$fieldType || !($fieldType == 'Int' || $fieldType == 'SilverStripe\\ORM\\FieldType\\DBInt' || is_subclass_of($fieldType, 'SilverStripe\\ORM\\FieldType\\DBInt'))) {
|
||||
if (is_array($fieldType)) {
|
||||
user_error('Sort column ' . $this->sortColumn . ' could not be found in ' . $gridField->getModelClass() . '\'s ancestry', E_USER_ERROR);
|
||||
} else {
|
||||
@ -261,7 +261,7 @@ class GridFieldSortableRows implements GridField_HTMLProvider, GridField_ActionP
|
||||
|
||||
$extraFields = $schema->manyManyExtraFieldsForComponent(get_class($owner), (!empty($this->custom_relation_name) ? $this->custom_relation_name : $gridField->getName()));
|
||||
|
||||
if (!$extraFields || !array_key_exists($this->sortColumn, $extraFields) || !($extraFields[$this->sortColumn] == 'SilverStripe\\ORM\\FieldType\\DBInt' || is_subclass_of('SilverStripe\\ORM\\FieldType\\DBInt', $extraFields[$this->sortColumn]))) {
|
||||
if (!$extraFields || !array_key_exists($this->sortColumn, $extraFields) || !($extraFields[$this->sortColumn] == 'Int' || $extraFields[$this->sortColumn] == 'SilverStripe\\ORM\\FieldType\\DBInt' || is_subclass_of('SilverStripe\\ORM\\FieldType\\DBInt', $extraFields[$this->sortColumn]))) {
|
||||
user_error('Sort column ' . $this->sortColumn . ' must be an SilverStripe\\ORM\\FieldType\\DBInt, column is of type ' . $extraFields[$this->sortColumn], E_USER_ERROR);
|
||||
exit;
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ class GridFieldAction_SortOrder_Team extends DataObject implements TestOnly
|
||||
private static $db = array(
|
||||
'Name' => DBVarchar::class,
|
||||
'City' => DBVarchar::class,
|
||||
'SortOrder' => DBInt::class
|
||||
'SortOrder' => 'Int'
|
||||
);
|
||||
|
||||
private static $default_sort = 'SortOrder';
|
||||
|
Loading…
Reference in New Issue
Block a user