mirror of
https://github.com/symbiote/silverstripe-gridfieldextensions.git
synced 2024-10-22 17:05:39 +02:00
BUG Ensure that sorting a row doesn't destroy any unsaved inline changes
This commit is contained in:
parent
b4a0c9618b
commit
f57278b11a
@ -199,6 +199,10 @@ class GridFieldOrderableRows extends RequestHandler implements
|
||||
|
||||
/**
|
||||
* 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 @@ class GridFieldOrderableRows extends RequestHandler implements
|
||||
$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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user