Inline editing of tabular data
This is the EditableColumn widget from Vitaliy Potapov.
Using this widget you can make editable one column of CGridView
.
Let's pretend we have a table of the various regions from all over the world, and we want to be able to rename any of them.
Country code | Name |
---|---|
US | Puerto Rico |
US | Palau |
US | Rhode Island |
US | South Carolina |
US | South Dakota |
US | Tennessee |
US | Texas |
US | Utah |
US | Virginia |
US | Virgin Islands |
$this->widget( 'booster.widgets.TbGridView', array( 'type' => 'striped bordered', 'dataProvider' => new CActiveDataProvider('Region'), 'columns' => array( 'country_code', array( 'class' => 'booster.widgets.TbEditableColumn', 'name' => 'name', 'sortable' => false, 'editable' => array( 'url' => $this->owner->createUrl('example/editable'), 'placement' => 'right', 'inputclass' => 'span3' ) ) ), ) );
There's only one specific property:
Property | Description |
---|---|
array editable = array() |
This is the configuration for editable widget inside this column. It is identical to the config for TbEditableField. |
You can look at the other options at the Yii documentation for CDataColumn
.