Creates a "add element" row in a CGridView

We sometimes want to add elements (lines) when being in "admin view", without changing the page we are on.


Yii 1.1


  • 10/14/2013 : Added the fillIsFilter option. When setted, the fillable row is also filtering the grid.


  1. Download the extension and extract the file in your protected/extensions/ directory
  2. Check that "application.extensions.*" is in your import array in your config file
  3. Follow the example code (Usage section)


This extension add a "fillable" section in a CGridView widget. Here is an example of the usage.

The grid contains 4 columns: ColId (id), MyCol1 (text), MyCol2 (text), MyCol3 (relationnal select). We want to add, at the end of the grid, a form with inputs for the fillable fields (not the id) and in the action column a "plus" icon to do the action.

$this->widget('application.extensions.EFillableCGridView', array(
   // **** Here starts the addition ****
   'fillable' => array(
      'columns' => array(
            'name' => 'MyCol1',
            'value' => CHtml::textField($model,'MyCol1')
            'name' => 'MyCol2',
            'value' => CHtml::textField($model,'MyCol2')
            'name' => 'MyCol3',
            'value' => CHtml::dropDownList($model, 'MyCol3', CHtml::listData(Col3::model()->findAll(), 'idCol3', 'nameCol3')),
      'CButtonColumn' => array(
         'button' => '<a href="'.Yii::app()->createUrl('control/createAjax').'"><img style="vertical-align: middle;" src="'. Yii::app()->baseUrl .'/images/ico_plus.gif" alt="plus"></a>',
         'action' => Yii::app()->createUrl('control/createAjax'),
      'position' => 'bottom',
      'fillIsFilter' => true,
   // **** Here ends the addition ****
         'name' => 'MyCol3',
         'value' => '$data->Col3->nameCol3',


The fillable section contains 4 subsections:

  • columns is the list of columns you want to add. Each column is defined with a name (must reflect the names used in the grid) and a value: the html input.

  • CButtonColumn is an array containing action (the action of the ajax form) and button, the html link you'll use to send the form.

  • position (optional) is where you want to have the form. Default is 'bottom' (after the last line, before footer), you can set it to 'top' (after the filters)

  • fillIsFilter (optional) allow the fillable row to also be a filter row. When setted to true (or 1, or anything you want), it is a filter until you submit the datas

Total 7 comments

#17643 report it
sefburhan at 2014/07/10 03:18am
Demo ?

Thanks for such valuable work, I really appreciate this as most clients demand for SPA(Single page application) but can give a link for demo to check it immediately rather to test locally and report bugs or say thanks?

#14307 report it
CrazyCat at 2013/08/04 04:12am

Hello poorroop,

I've added an "Installation" section in the documentation, check the points 1 & 2 are ok.

And also check you call the good widget (application.extensions.EFillableCGridView).


#14305 report it
poorroop at 2013/08/03 04:20pm
Installation Please

Can you please let me know the instructions how to install this extnesion

I am getting this error

Property "CGridView.fillable" is not defined.

thank you - reddy

#14187 report it
CrazyCat at 2013/07/25 03:04am
Bug in your relation ?

Hello Daniel,

I think the trouble is not coming from the extension but from the way you use your ReportSetting in it. Can you join the support thread and show me your view code ?

#14183 report it
Daniel at 2013/07/24 10:11pm
still not working.....


I am still getting error after changing the CActiveForm to CHtml. The error message is

Object of class ReportSetting could not be converted to string



#14153 report it
CrazyCat at 2013/07/23 05:06am
My example is not strict :)

Hello Daniel,

Sorry for this small error, I'll try to do better code next time and verify it. I didn't got this error because of my permissives settings of PHP.

You're lucky, using the good call, it will work. Replace all the CActiveForm:: with CHtml::


P.S.: example code corrected

#14152 report it
Daniel at 2013/07/23 04:44am


I got this error:

Non-static method CActiveForm::textField() should not be called statically, assuming $this from incompatible context

Any help?

Leave a comment

Please to leave your comment.

Create extension