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

This commit is contained in:
Shea 2012-09-10 13:38:00 +10:00
parent 09af046dc5
commit 04c49653a6
2 changed files with 5 additions and 5 deletions

View File

@ -230,15 +230,15 @@ class GridFieldSortableRows implements GridField_HTMLProvider, GridField_ActionP
//@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();
}

View File

@ -41,7 +41,7 @@
value: button.val()
},
{
name: 'Items',
name: 'ItemIDs',
value: dataRows
}
]});