Gridview, How To Pass $Data Into A Javascript Funtion

Hello,

I have this code :




 array(

            'class' => 'bootstrap.widgets.TbButtonColumn',

            'template' => '{update}',

            'buttons' => array(

                'update' => array(

                    'icon' => 'tasks',

                    'value' => '$data->date_inscription',

                    'label' => Yii::t('view', 'saisirAbsence'),

                    'visible' => '(Yii::app()->user->checkAccess("demAbsence.createAbsence") 

                        &&  Yii::app()->getController()->getAction()->getId() == "saisirPresence")? true : false',

                    'click' => 'function(){ $(\'#dialogAbsence\').dialog(\'open\');

                       $("#mesureId").val({$data->date_inscription});

                        return false;}',

                ),

            ),     



but here :




$("#mesureId").val({$data->date_inscription});



it is not working.

I get this error :

he dont’t know about $data->date_inscription.

Someone know how I can do ?

thanks

Nath

Dear Friend

When constructing a button, only the following parameters evaluates PHP expression in which we can make use of

$row and $data.

1.url.

2.visible.

The parameter click does not have this luxary.

One ugly workaround is given below.




'buttons'=>array(

		'log'=>array(

		'label'=>'Log',

		'url'=>'$data->name', //declaring  the property  as a url

		'click'=>'function(){

                                      console.log($(this).attr("href"));

                                      return false; 

                                    }'	//getting the property as url.Preventing the default behavior.		

			),



Regards.

even if it is ugly, thank you so much !