Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

FIX: Ensure valid CSS classes for GridField header (fixes #2361) #2875

Merged
merged 1 commit into from

2 participants

@kinglozzer
Collaborator

No description provided.

@simonwelsh simonwelsh merged commit bc8d2d6 into silverstripe:3.1
@kinglozzer kinglozzer deleted the kinglozzer:2361-gridfield-column-header-css branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 3 deletions.
  1. +4 −3 forms/gridfield/GridFieldSortableHeader.php
View
7 forms/gridfield/GridFieldSortableHeader.php
@@ -92,6 +92,7 @@ public function getHTMLFragments($gridField) {
foreach($columns as $columnField) {
$currentColumn++;
$metadata = $gridField->getColumnMetadata($columnField);
+ $fieldName = str_replace('.', '-', $columnField);
$title = $metadata['title'];
if(isset($this->fieldSorting[$columnField]) && $this->fieldSorting[$columnField]) {
@@ -132,7 +133,7 @@ public function getHTMLFragments($gridField) {
}
$field = Object::create(
- 'GridField_FormAction', $gridField, 'SetOrder'.$columnField, $title,
+ 'GridField_FormAction', $gridField, 'SetOrder'.$fieldName, $title,
"sort$dir", array('SortColumn' => $columnField)
)->addExtraClass('ss-gridfield-sort');
@@ -148,10 +149,10 @@ public function getHTMLFragments($gridField) {
if($currentColumn == count($columns)
&& $gridField->getConfig()->getComponentByType('GridFieldFilterHeader')){
- $field = new LiteralField($columnField,
+ $field = new LiteralField($fieldName,
'<button name="showFilter" class="ss-gridfield-button-filter trigger"></button>');
} else {
- $field = new LiteralField($columnField, '<span class="non-sortable">' . $title . '</span>');
+ $field = new LiteralField($fieldName, '<span class="non-sortable">' . $title . '</span>');
}
}
$forTemplate->Fields->push($field);
Something went wrong with that request. Please try again.