Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…nitialise $dataListClone
  • Loading branch information...
commit e096c297b8abf5a1dd4e66be5d09b8d76fa5a698 1 parent 630ab87
Jeremy Bridson authored
View
13 forms/HtmlEditorField.php
@@ -362,11 +362,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) {

0 comments on commit e096c29

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