Permalink
Browse files

CGridview does not create empty class attribute

fixes #1163 where rowCssClassExpression or rowCssClass could be empty
for certain rows.
  • Loading branch information...
1 parent 9d58b32 commit 74289854ce23c34b4f05aafa5e450cd8dc788ec7 @cebe committed Aug 7, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 framework/zii/widgets/grid/CGridView.php
@@ -568,12 +568,14 @@ public function renderTableRow($row)
if($this->rowCssClassExpression!==null)
{
$data=$this->dataProvider->data[$row];
- echo '<tr class="'.$this->evaluateExpression($this->rowCssClassExpression,array('row'=>$row,'data'=>$data)).'">';
+ $class=$this->evaluateExpression($this->rowCssClassExpression,array('row'=>$row,'data'=>$data));
}
else if(is_array($this->rowCssClass) && ($n=count($this->rowCssClass))>0)
- echo '<tr class="'.$this->rowCssClass[$row%$n].'">';
+ $class=$this->rowCssClass[$row%$n];
else
- echo '<tr>';
+ $class='';
+
+ echo empty($class) ? '<tr>' : '<tr class="'.$class.'">';
foreach($this->columns as $column)
$column->renderDataCell($row);
echo "</tr>\n";

0 comments on commit 7428985

Please sign in to comment.