Skip to content
This repository
Browse code

BUGFIX: open ticket 7603 fixing search filtering - thought I should i…

…nitialise $dataListClone
  • Loading branch information...
commit e096c297b8abf5a1dd4e66be5d09b8d76fa5a698 1 parent 630ab87
authored July 11, 2012
13  forms/HtmlEditorField.php
@@ -362,11 +362,14 @@ function MediaForm() {
362 362
 		// TODO Handle through GridState within field - currently this state set too late to be useful here (during request handling)
363 363
 		$parentID = $this->controller->getRequest()->requestVar('ParentID');
364 364
 
365  
-		$fileFieldConfig = GridFieldConfig::create();
366  
-		$fileFieldConfig->addComponent(new GridFieldSortableHeader());
367  
-		$fileFieldConfig->addComponent(new GridFieldFilterHeader());
368  
-		$fileFieldConfig->addComponent(new GridFieldDataColumns());
369  
-		$fileFieldConfig->addComponent(new GridFieldPaginator(5));
  365
+		$fileFieldConfig = GridFieldConfig::create()->addComponents(
  366
+			new GridFieldFilterHeader(),
  367
+			new GridFieldSortableHeader(),
  368
+			new GridFieldDataColumns(),
  369
+			new GridFieldPaginator(5),
  370
+			new GridFieldDeleteAction(),
  371
+			new GridFieldDetailForm()
  372
+		);
370 373
 		$fileField = new GridField('Files', false, null, $fileFieldConfig);
371 374
 		$fileField->setList($this->getFiles($parentID));
372 375
 		$fileField->setAttribute('data-selectable', true);
5  forms/gridfield/GridFieldFilterHeader.php
@@ -91,12 +91,13 @@ public function getManipulatedData(GridField $gridField, SS_List $dataList) {
91 91
 		} 
92 92
 		
93 93
 		$filterArguments = $state->Columns->toArray();
  94
+		$dataListClone = null;
94 95
 		foreach($filterArguments as $columnName => $value ) {
95 96
 			if($dataList->canFilterBy($columnName) && $value) {
96  
-				$dataList->filter($columnName.':PartialMatch', $value);
  97
+				$dataListClone = $dataList->filter($columnName.':PartialMatch', $value);
97 98
 			}
98 99
 		}
99  
-		return $dataList;
  100
+		return ($dataListClone) ? $dataListClone : $dataList;
100 101
 	}
101 102
 
102 103
 	public function getHTMLFragments($gridField) {

0 notes on commit e096c29

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