Question

I try use callback. If data success update then i need to display modal window. But its not working! Help please! I dont know, how it works. Write me please.

In View

 <?php
    $this->widget('editable.EditableField', array(
    'type' => 'select',
    'params' => array('YII_CSRF_TOKEN' => Yii::app()->request->csrfToken),
    'model' => $model,
    'attribute' => 'category_id',
    'url' => $this->createUrl('course/updateSameInfo'),
    'source' => Editable::source(Coursecat::model()->findAll(), 'id', 'name'),
    'placement' => 'right',
    ));
?>

In Controller

public function actionUpdateSameInfo()
{
 $es = new EditableSaver('Course'); //'User' is name of model to be updated
 $es->update();
}
Was it helpful?

Solution

Use success property. Here is the documentation http://x-editable.demopage.ru/index.php?r=site/widgets#Options

Try this

    <?php
    $this->widget('editable.EditableField', array(
    'type' => 'select',
    'params' => array('YII_CSRF_TOKEN' => Yii::app()->request->csrfToken),
    'model' => $model,
    'attribute' => 'category_id',
    'url' => $this->createUrl('course/updateSameInfo'),
    'source' => Editable::source(Coursecat::model()->findAll(), 'id', 'name'),
    'placement' => 'right',
    'success' => 'js: function(response, newValue) {
            console.log(response); //Open the browser console to check the data
        }'
    ));
    ?>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top