CGridColumn::filterHtmlOptions - missing property?


There are some properties in CGridColumn for adding special html options:


 * @var array the HTML options for the data cell tags.


public $htmlOptions=array();



 * @var array the HTML options for the header cell tag.


public $headerHtmlOptions=array();



 * @var array the HTML options for the footer cell tag.


public $footerHtmlOptions=array();

But there is no such property for filter cells. It can be implemented like this:


 * @var array the HTML options for the filter cell tag.


public $filterHtmlOptions=array();


 * Renders the filter cell.


public function renderFilterCell() {

  echo CHtml::openTag('td', $this->filterHtmlOptions);


  echo "</td>";


For example, without this you cannot hide column with style="display:none;" (filter cell will be visible).

Thanks for this info.

It helped me save lot of frustration. I feel that this feature should have been implemented in Yii itself, rather than having us modify the inbuilt Yii files.

If you don’t want the filter for a specific column… you can set it’s filter property to false -

Yes, but this has the effect of rendering


, when you might sometimes want to hide the entire cell instead.