Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #634 from silverstripe-rebelalliance/3.0_7603

BUGFIX: open ticket 7603 fixing search filtering - thought I should initialise $dataListClone
  • Loading branch information...
commit 998b8e048c470875adb6e5eb74dbb095905664c0 2 parents a830b1f + e096c29
@chillu chillu authored
View
13 forms/HtmlEditorField.php
@@ -365,11 +365,14 @@ function MediaForm() {
// TODO Handle through GridState within field - currently this state set too late to be useful here (during request handling)
$parentID = $this->controller->getRequest()->requestVar('ParentID');
- $fileFieldConfig = GridFieldConfig::create();
- $fileFieldConfig->addComponent(new GridFieldSortableHeader());
- $fileFieldConfig->addComponent(new GridFieldFilterHeader());
- $fileFieldConfig->addComponent(new GridFieldDataColumns());
- $fileFieldConfig->addComponent(new GridFieldPaginator(5));
+ $fileFieldConfig = GridFieldConfig::create()->addComponents(
+ new GridFieldFilterHeader(),
+ new GridFieldSortableHeader(),
+ new GridFieldDataColumns(),
+ new GridFieldPaginator(5),
+ new GridFieldDeleteAction(),
+ new GridFieldDetailForm()
+ );
$fileField = new GridField('Files', false, null, $fileFieldConfig);
$fileField->setList($this->getFiles($parentID));
$fileField->setAttribute('data-selectable', true);
View
5 forms/gridfield/GridFieldFilterHeader.php
@@ -91,12 +91,13 @@ public function getManipulatedData(GridField $gridField, SS_List $dataList) {
}
$filterArguments = $state->Columns->toArray();
+ $dataListClone = null;
foreach($filterArguments as $columnName => $value ) {
if($dataList->canFilterBy($columnName) && $value) {
- $dataList->filter($columnName.':PartialMatch', $value);
+ $dataListClone = $dataList->filter($columnName.':PartialMatch', $value);
}
}
- return $dataList;
+ return ($dataListClone) ? $dataListClone : $dataList;
}
public function getHTMLFragments($gridField) {
Please sign in to comment.
Something went wrong with that request. Please try again.