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 |
---|---|
AD | Andorra la Vella |
AD | Escaldes-Engordany |
AE | Abu Dhabi |
AE | Ajman |
AE | Dubai |
AE | Fujairah |
AE | Ras Al Khaimah |
AE | Sharjah |
AE | Umm Al Quwain |
AF | Badakhshan |
$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
.