Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added css class for sorted columns #2604

Merged
merged 2 commits into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,33 @@ public function getGrid()
return $this->_grid;
}

/**
* @return bool
*/
public function isLast()
{
return $this->getId() == $this->getGrid()->getLastColumnId();
}

/**
* @return string
*/
public function getHtmlProperty()
{
return $this->getRenderer()->renderProperty();
}

/**
* @return string
*/
public function getHeaderHtml()
{
return $this->getRenderer()->renderHeader();
}

/**
* @return string|null
*/
public function getCssClass()
{
if (is_null($this->_cssClass)) {
Expand All @@ -83,16 +95,26 @@ public function getCssClass()
if ($this->getEditable()) {
$this->_cssClass .= ' editable';
}
// Add css class for sorted columns
if ($this->hasData('dir')) {
$this->_cssClass .= ' sorted';
}
}

return $this->_cssClass;
}

/**
* @return string|null
*/
public function getCssProperty()
{
return $this->getRenderer()->renderCss();
}

/**
* @return string|null
*/
public function getHeaderCssClass()
{
$class = $this->getData('header_css_class');
Expand All @@ -102,9 +124,15 @@ public function getHeaderCssClass()
if ($this->isLast()) {
$class .= ' last';
}
if ($this->hasData('dir')) {
$class .= ' sorted';
}
return $class;
}

/**
* @return string
*/
public function getHeaderHtmlProperty()
{
$str = '';
Expand Down Expand Up @@ -374,14 +402,16 @@ public function getFilter()
return $this->_filter;
}

/**
* @return string
*/
public function getFilterHtml()
{
if ($this->getFilter()) {
return $this->getFilter()->getHtml();
} else {
return ' ';
}
return null;

return ' ';
}

/**
Expand Down
2 changes: 2 additions & 0 deletions js/mage/adminhtml/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ varienGrid.prototype = {
for (var row=0; row<this.rows.length; row++) {
if(row%2==0){
Element.addClassName(this.rows[row], 'even');
}else{
Element.addClassName(this.rows[row], 'odd');
}

Event.observe(this.rows[row],'mouseover',this.trOnMouseOver);
Expand Down
Loading