php - how to pass the view id to the CJuiDialog box?
821
here's my code
<?php
$this->widget('zii.widgets.grid.CGridView',array(
'dataProvider'=>$dataProvider,
'columns' => array(
array(
'name' => 'emailaddress',
'htmlOptions' => array(
'width' => '30',
),
),
array(
'name' => 'secretkey',
'htmlOptions' => array(
'width' => '40px',
),
),
array(
'header' => 'Options',
'class' => 'CButtonColumn',
'template' => '{view}{update}{delete}',
),
array(
'header' => 'Copy URLs',
'class' => 'CButtonColumn',
'template' => '{copy}',
'buttons' => array(
'copy' => array(
'label' => 'copy url',
'url' => 'Yii::app()->createUrl("emails/view",array("id"=>$data["emailid"]))',
'options' => array('id' => $data["emailid"]),
'click' => 'function(){$("#mydialog").dialog("open"); return false;}',
)
),
),
),
));
?>
<?php
$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
'id' => 'mydialog',
'options' => array(
'title' => 'URL + Key',
'autoOpen' => false,
'width' => 500,
'height' => 300,
),
));
//THIS PART SHOULD RECEIVE THE ID SO THAT I CAN QUERY TO THE DB TABLE
?>
<?php
$this->endWidget('zii.widgets.jui.CJuiDialog');
?>
my question is, how will i pass the ID of the clicked row, to the Dialog box? , so that I can use that ID in order to render the correct contents inside the dialog box ? because with the help of that ID, i can do a db query like this
SELECT u.url,e.secretKey FROM tbl_emails AS e, tbl_urls AS u
WHERE emailid = ID;
Answer
Solution:
Use the jQuery data method. For example: