The searchCriteria will be added as $_GET to the form action, rather than that TableListField's extraLinkParams

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@61511 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Normann Lou 2008-08-26 01:54:53 +00:00
parent 4870a9f340
commit eea6cf978d

View File

@ -473,13 +473,13 @@ class ModelAdmin_CollectionController extends Controller {
$summaryFields = $model->summaryFields(); $summaryFields = $model->summaryFields();
$resultAssembly = $searchCriteria['ResultAssembly']; $resultAssembly = $searchCriteria['ResultAssembly'];
foreach($summaryFields as $fieldname=>$label){ if(!is_array($resultAssembly)) {
if(!$resultAssembly[$fieldname]){ $explodedAssembly = split(' *, *', $resultAssembly);
unset($summaryFields[$fieldname]); $resultAssembly = array();
} foreach($explodedAssembly as $item) $resultAssembly[$item] = true;
} }
return $summaryFields; return array_intersect_key($summaryFields, $resultAssembly);
} }
/** /**
@ -516,16 +516,12 @@ class ModelAdmin_CollectionController extends Controller {
new FieldSet() new FieldSet()
); );
// HACK to preserve search parameters on TableField // Include the search criteria on the results form URL, but not dodgy variables like those below
// ajax actions like pagination $filteredCriteria = $searchCriteria;
$filteredParams = $this->request->getVars(); unset($filteredCriteria['ctf']);
unset($filteredParams['ctf']); unset($filteredCriteria['url']);
unset($filteredParams['url']); unset($filteredCriteria['action_search']);
unset($filteredParams['action_search']); $form->setFormAction($this->Link() . '/ResultsForm?' . http_build_query($filteredCriteria));
$tf->setExtraLinkParams($filteredParams);
$form->setFormAction($this->Link() . '/ResultsForm?' . http_build_query($searchCriteria));
return $form; return $form;
} }