Is there a way to utilize the cell just below the header of the CButtonColumn in a gridview? I would like to use this space to put a filter reset link.


Probably not, because CDataColumn is the only column type that has a filter property published. I would suggest using footer of CGridView or search form above it as a good places to put filter reset button. If you really urgently need to have your reset button there, where you described, the only option is to change CGridView with CListView and use two different views, one for rendering header and filter area and second, for rendering normal data rows. But in this situation you have to code all the filtering magic yourself, as it is implemented in CGridView only.


You may give this a try:

Extend CGridView, override renderFilter() and add e.g renderClearFiltersButton()

public function renderFilter()




        echo "<tr class=\"{$this->filterCssClass}\">\n";

        foreach($this->columns as $column)



        // ADDED CODE HERE



        echo "</tr>\n";



Implement a click handler in jQuery for the Clear Filter button:

E.g find parent tr element, iterate over and clear all child input elements. (Probable not a good idea to use a registerScript() call in renderClearFiltersButton(), though.)

(not tested)


Maybe this can also give you some ideas:


I achieved this by extending CButtonColumn and adding [font=“Courier New”]renderFilterCellContent()[/font] method. That’s all! I also wanted to use this space for resetting filters. This is how mine looks:

public function renderFilterCellContent() {                                                           

    echo CHtml::link('Reset filters', 'javascript:void(0)', array(                      

        'class' => 'btn filter-remove'



Besides that, I wanted to include the Javascript code that indeed resetted the inputs and updated the grid. Simple as overriding the [font="Courier New"]CButtonColumn::registerClientScript()[/font] method like this:

public function registerClientScript() {                                                              


    Yii::app()->getClientScript()->registerScript(__CLASS__.'#'.$this->id, "

        $(document).on('click', '#{$this->grid->id} .filter-remove', function() {                                                           

            $('#{$this->grid->id} .filters :input').val('').first().trigger('change.yiiGridView');            




Hope it helps!