How to use configure TbEditableColumn in Yiibooster?

I am trying to get TbEditableColumn to work using Yiibooster. I 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 this mean that I should already have an actionEditable () method or should I create one?

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

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

ATM updates the frontend, but when I refresh the page, it does not retain its meaning.

In this example, I hardcoded the identifier.

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

Yours faithfully:)

+4
source share
2 answers

You are still right. The method is quite simple, since an existing component exists for this. Put the following code in your controller and call image/editableSaver

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

The following worked for me.

in my admin.php view I had this code:

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

And in my respective controller I had this (according to @schmunk comments). With minor changes.

 public function actionEditableSaver() { Yii::import('bootstrap.widgets.TbEditableSaver'); $es = new TbEditableSaver('Image'); $es->update(); } 

So I needed to change

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

to

 public function actionEditableSaver() { Yii::import('bootstrap.widgets.TbEditableSaver'); $es = new TbEditableSaver('Image'); $es->update(); } 

To match the Tb prefix in my widget names (as downloaded from http://yii-booster.clevertech.biz/getting-started.html )

I hope this helps someone else.

+3
source

All Articles