Permalink
Browse files

BUGFIX: Filter IDs

Change ID of action buttons in the filter panel to be unique
  • Loading branch information...
1 parent 3f932d6 commit a412aa0ce44470080fd25d793acfa7c25ca9f353 @adrexia adrexia committed with halkyon May 17, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 forms/gridfield/GridFieldFilterHeader.php
@@ -104,7 +104,6 @@ public function getHTMLFragments($gridField) {
$forTemplate = new ArrayData(array());
$forTemplate->Fields = new ArrayList;
-
$columns = $gridField->getColumns();
$filterArguments = $gridField->State->GridFieldFilterHeader->Columns->toArray();
$currentColumn = 0;
@@ -122,23 +121,27 @@ public function getHTMLFragments($gridField) {
$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{

0 comments on commit a412aa0

Please sign in to comment.