Search code examples
phpyiiyii-extensions

How do I use configure TbEditableColumn in Yiibooster?


I am trying to get TbEditableColumn working using Yiibooster. I have followed the instructions here http://yii-booster.clevertech.biz/components.html#editable

I am confused by the line

'editable' => array(
'url' => $this->createUrl('site/editable'),
'placement' => 'right',
'inputclass' => 'span3'
)

Does that mean I should already have an actionEditable() method or need to create one?

I tried using the preexisting actionUpdate($id) method in the my image controller.

'editable' => array(
'url' => $this->createUrl('image/update', array('id'=>'1')),
'placement' => 'right',
'inputclass' => 'span3'

ATM it updates the front end but when I refresh the page it does not retain its value.

I have hard coded the id in this example.

If I need to create an actionEditable method, has anyone done this and can post how?

Kind regards :)


Solution

  • You're right so far. The method is pretty straightforward, as there is an existing component for that. Put the following code into your controller and call image/editableSaver

    public function actionEditableSaver()
    {
        Yii::import('path.to.editable.EditableSaver');
        $es = new EditableSaver('MyModel');
        $es->update();
    }