BUGFIX: Filter IDs

Change ID of action buttons in the filter panel to be unique
This commit is contained in:
Naomi Guyer 2012-05-17 12:37:53 +12:00 committed by Sean Harvey
parent 3f932d6bad
commit a412aa0ce4

View File

@ -104,7 +104,6 @@ class GridFieldFilterHeader implements GridField_HTMLProvider, GridField_DataMan
$forTemplate = new ArrayData(array());
$forTemplate->Fields = new ArrayList;
$columns = $gridField->getColumns();
$filterArguments = $gridField->State->GridFieldFilterHeader->Columns->toArray();
$currentColumn = 0;
@ -122,23 +121,27 @@ class GridFieldFilterHeader implements GridField_HTMLProvider, GridField_DataMan
$field = new TextField('filter['.$columnField.']', '', $value);
$field->addExtraClass('ss-gridfield-sort');
$field->setAttribute('placeholder', _t('GridField.FilterBy', "Filter by ")._t('GridField.'.$metadata['title'], $metadata['title']));
$field->setAttribute('placeholder', _t('GridField.FilterBy', "Filter by ") . _t('GridField.'.$metadata['title'], $metadata['title']));
$field = new FieldGroup(
$field,
GridField_FormAction::create($gridField, 'reset', false, 'reset', null)
->addExtraClass('ss-gridfield-button-reset')
->setAttribute('title', _t('GridField.ResetFilter', "Reset"))
->setAttribute('id', 'action_reset_'.$gridField->getModelClass() . '_' . $columnField)
);
} else {
if($currentColumn == count($columns)){
$field = new FieldGroup(
GridField_FormAction::create($gridField, 'filter', false, 'filter', null)
->addExtraClass('ss-gridfield-button-filter')
->setAttribute('title', _t('GridField.Filter', "Filter")),
->setAttribute('title', _t('GridField.Filter', "Filter"))
->setAttribute('id', 'action_filter_'.$gridField->getModelClass() . '_' . $columnField),
GridField_FormAction::create($gridField, 'reset', false, 'reset', null)
->addExtraClass('ss-gridfield-button-close')
->setAttribute('title', _t('GridField.ResetFilter', "Reset"))
->setAttribute('title', _t('GridField.ResetFilter', "Reset"))
->setAttribute('id', 'action_reset_'.$gridField->getModelClass() . '_' . $columnField)
);
$field->addExtraClass('filter-buttons');
}else{