diff --git a/code/GridFieldOrderableRows.php b/code/GridFieldOrderableRows.php index bb8a1ecb..0be7897c 100755 --- a/code/GridFieldOrderableRows.php +++ b/code/GridFieldOrderableRows.php @@ -199,6 +199,10 @@ public function getManipulatedData(GridField $grid, SS_List $list) { /** * Handles requests to reorder a set of IDs in a specific order. + * + * @param GridField $grid + * @param SS_HTTPRequest $request + * @return SS_HTTPResponse */ public function handleReorder($grid, $request) { $list = $grid->getList(); @@ -234,6 +238,12 @@ public function handleReorder($grid, $request) { $this->httpError(404); } + // Save any un-comitted changes to the gridfield + if(($form = $grid->getForm()) && ($record = $form->getRecord()) ) { + $form->loadDataFrom($request->requestVars(), true); + $grid->saveInto($record); + } + // Populate each object we are sorting with a sort value. $this->populateSortValues($items);