BUGFIX: open ticket 7603 fixing search filtering - thought I should initialise $dataListClone

This commit is contained in:
Jeremy Bridson 2012-07-11 09:19:50 +12:00
parent 630ab878c9
commit e096c297b8
2 changed files with 11 additions and 7 deletions

View File

@ -362,11 +362,14 @@ class HtmlEditorField_Toolbar extends RequestHandler {
// 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 File

@ -91,12 +91,13 @@ class GridFieldFilterHeader implements GridField_HTMLProvider, GridField_DataMan
}
$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) {