Guest User

Untitled

a guest
Mar 19th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. app/design/adminhtml/default/default/template/widget/grid.phtml
  2.  
  3. _column->getCssProperty()
  4.  
  5. Mage_Adminhtml_Block_Widget_Grid_Column::getCssProperty
  6.  
  7. $this->getRenderer()->renderCss();
  8.  
  9. Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract::renderCss
  10.  
  11. $this->setTemplate('path/to/your/grid.phtml');
  12.  
  13. $this->addColumn('code_here', array(
  14. 'header' => $this->__('label here'),
  15. 'index' => 'code_here',
  16. 'column_css_class' => 'has_dynamic_class'
  17. ));
  18.  
  19. Event.observe(window, 'load', function() {
  20. $$('td.has_dynamic_class').each(function(elem){
  21. var value = $(elem).innerHTML;
  22. var class = calculate class here depending on 'value'
  23. $(elem).addClassName('class');
  24. })
  25. });
  26.  
  27. public function getRowClass($row)
  28. {
  29. return $row->getId() == 123 ? 'selected-row-class' : '';
  30. }
  31.  
  32. $this->addColumn('my_col', [
  33. 'header' => 'Col Name',
  34. 'index' => 'my_col',
  35. 'column_css_class' => 'my-specific-col'
  36. ]);
  37.  
  38. .selected-row-class.my-specific-col {
  39. background-color: pink;
  40. }
Add Comment
Please, Sign In to add comment