Search code examples
yiicgridview

How to edit column in CGridView


How is it possible, to make the columns in CGridView editable? i searched and find several extensions, but nothing works for me. i'm doing something wrong or the extensions are buggy, i don't know.

can anyone help me please, and describe exactly, what i have to do, to make my columns in CGridView editable?


Solution

  • Yii-booster extension has class TbEditableColumn that implements column edit feature. You can look example here. There is my example of code:

        array(
            'class' => 'YbEditableColumn',
            'name' => 'priority',
            'value' => '$data->priorityName',
            'sortable' => false,
            'editable' => array(
                'type' => 'select',
                'source' => Task::model()->getPriorities(),
                'url' => $this->createUrl('update'),
                'placement' => 'top',
            )
        ),
    

    There is other extensions based on bootstrap Editable, like this, may be you can check it too.