Jeditable, Gridview And Error

Hello,

I am using jeditable with gridview.




Yii::app()->clientScript->registerScript('status','

    $("a[class^=editable-]").editable("'.Controller :: createUrl('TRapportsActivites/update').'", {

        submitdata : function (value,settings){

                        return {"TRapportsActivites[rapport_activite_id]":$(this).attr("class").substr("9"),};

                    },

        indicator : "Saving...",

        tooltip   : "Click to edit...",

        type : "text",

        event: "dblclick",

        style: "inherit",

        name : "TRapportsActivites[heures]",

        success:function(data){

        alert("error");

           $("#msgError").empty();

        },

        onerror:function(data){

        alert(data.msg);

            $("#msgError").empty();

            $("#msgError").append(data.msg);

        },

        

     

     });


',CClientScript::POS_READY);



My controller :




public function actionUpdate() {

        $id = $_POST['TRapportsActivites']['rapport_activite_id'];

        $model = $this->loadModel($id);


        // Uncomment the following line if AJAX validation is needed

        //$this->performAjaxValidation($model);


        if (isset($_POST['TRapportsActivites'])) {

            $model->attributes = $_POST['TRapportsActivites'];

          // $model->save();

            if ($model->save()){

                echo $model->heures;

            }else{

                echo json_encode(array('resultat' => 'notOk', 'msg' => CHtml::errorSummary($model),'result'=>'error'));

            }

        }

    }



It is working well when I don’t have error, But if I have error, I cano’t catch it.

Sommeone know how to do it ?

thanks

nath

Where in yii have you put ‘jeditable’ package?

Hi nath-0.

Try "error:" instead of "onerror:".