Permalink
Browse files

BUGFIX renamed the Items array that is sent in post, as it was being …

…overriden by another postvar called Items, containing GridState data. The array of Item Ids used by SortableGridField is now called ItemIDs
  • Loading branch information...
1 parent 09af046 commit 04c49653a6569b0c34ca5737178e9a8978e2ccf7 Shea committed Sep 10, 2012
Showing with 5 additions and 5 deletions.
  1. +4 −4 code/forms/GridFieldSortableRows.php
  2. +1 −1 javascript/GridFieldSortableRows.js
@@ -230,15 +230,15 @@ protected function saveGridRowSort(GridField $gridField, $data) {
//@TODO Need to optimize this to eliminate some of the resource load could use raw queries to be more efficient
- $data['Items'] = explode(',', $data['Items']);
- for($sort = 0;$sort<count($data['Items']);$sort++) {
- $id = intval($data['Items'][$sort]);
+ $ids = explode(',', $data['ItemIDs']);
+ for($sort = 0;$sort<count($ids);$sort++) {
+ $id = intval($ids[$sort]);
if ($many_many) {
DB::query('UPDATE "' . $table
. '" SET "' . $sortColumn.'" = ' . (($sort + 1) + $pageOffset)
. ' WHERE "' . $componentField . '" = ' . $id . ' AND "' . $parentField . '" = ' . $owner->ID);
} else {
- $obj = $items->byID($data['Items'][$sort]);
+ $obj = $items->byID($ids[$sort]);
$obj->$sortColumn = ($sort + 1) + $pageOffset;
$obj->write();
}
@@ -41,7 +41,7 @@
value: button.val()
},
{
- name: 'Items',
+ name: 'ItemIDs',
value: dataRows
}
]});

0 comments on commit 04c4965

Please sign in to comment.