Skip to content
This repository
Browse code

BUG Force refresh of GridFieldDetailEditForm after save

Wasn't refreshing after ajax save operations on existing
content, as the URL didn't change, and hence the CMS
didn't reload the view. Return the view directly instead,
unless we're dealing with new records (= changed URL).
  • Loading branch information...
commit 06cddb747a1f2a045ba907aa3e79c4b51f8a5ae8 1 parent 47b56d4
Ingo Schommer authored August 20, 2012

Showing 1 changed file with 7 additions and 1 deletion. Show diff stats Hide diff stats

  1. 8  forms/gridfield/GridFieldDetailForm.php
8  forms/gridfield/GridFieldDetailForm.php
@@ -384,7 +384,13 @@ function doSave($data, $form) {
384 384
 		
385 385
 		$form->sessionMessage($message, 'good');
386 386
 
387  
-		return Controller::curr()->redirect($this->Link());
  387
+		if($new_record) {
  388
+			return Controller::curr()->redirect($this->Link());
  389
+		} else {
  390
+			// Return new view, as we can't do a "virtual redirect" via the CMS Ajax
  391
+			// to the same URL (it assumes that its content is already current, and doesn't reload)
  392
+			return $this->edit(Controller::curr()->getRequest());
  393
+		}
388 394
 	}
389 395
 
390 396
 	function doDelete($data, $form) {

0 notes on commit 06cddb7

Please sign in to comment.
Something went wrong with that request. Please try again.