2016-04-27 4 views
0

ボタンのクリックでjsに選択したIDを渡そうとしています。yii:jsでパラメータを渡す

私のコードは次のようである:ここでは

array(
    'class'=>'CButtonColumn', 
    'template'=>'{email}', 
    'buttons'=>array 
    (
     'email' => array 
     (
      'label'=>'Send an e-mail to this user', 
      'click'=>'function($data->userId){ 
       var y=confirm("Are you sure to send mail to this user?"); 
       if(y==true){ 
        window.location="todoList/sendEmail/$data->userId"; 
       } 
      }', 

     ), 

    ), 
), 

私は、ユーザーID内のJSを取得することはできませんよ。

ここで何ができますか?

答えて

2

[OK]を私は私の質問のmyself.My作業コードに答えを見つけたです:

array(
'class'=>'CButtonColumn', 
'template'=>'{email}', 
'buttons'=>array 
( 'email' => array 
    (
     'label'=>'Send an e-mail to this user', 
     'click'=>'function(){ 
      return confirm("Are you sure to send mail to this user?"); 

     }', 
     'url'=>'Yii::app()->createUrl("todoList/sendEmail", array("id"=>$data->userId))', 
    ), 
), 

)、