I have tried to make a confirmation button with CButtonColumn, using CJuiDialog, but the problem is that i need to know the id of the row that i selected in the CJuiDialog… this is the code that i used but had no success:
<?php
$target = 'window.location='."'".$this->createUrl("activar",array("id"=>$model->IDIdioma))."'";
$this->beginWidget('zii.widgets.jui.CJuiDialog', array( // the dialog
'id'=>'dialogClassroom',
'options'=>array(
'title'=>'Aprobar Idioma',
'autoOpen'=>false,
'modal'=>true,
'width'=>200,
'height'=>100,
'show'=>'fade',
'buttons' => array
(
'Ok'=>'js:function(){$(this).dialog("close")}',
'Cancel'=>'js:function(){$(this).dialog("close")}',
),
//'buttons' => array('Close'=>'js:function(){$(this).dialog("close"))}'),
//'buttons' => array(
// 'Ok'=>'js:function(){$(this).dialog("close"))}'),
//'Cancel'=>'js:function(){$(this).dialog("close"))}'),
),
));?>
<?php echo "Desea aprobar el idioma?"?>
<div class="row buttons">
<?php echo CHtml::submitButton($model->isNewRecord ? ' Crear ' : ' Guardar '); ?>
</div>
<?php
/*<div class="row buttons">
<?php echo CHtml::ajaxSubmitButton('buttonSubmit'), CHtml::normalizeUrl(array('my_module/my_view', 'render' => false), array('update' => 'js: function() {..}')); ?>
</div>*/
$this->endWidget();
?>
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'idioma-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'IdiomaDesc',
array('name'=>'Estado','value'=>'Idioma::getEstado($data->Estado)'),
array(
'class'=>'CButtonColumn',
'template' => '{activo} {inactivo}',
'buttons' => array(
'activo' => array(
'label' => 'Activar',
'url' => 'Yii::app()->controller->createUrl("activar",array("id"=>$data->IDIdioma))',
'imageUrl' => Yii::app()->baseUrl.'/images/check.png',
//'confirm'=>'are you sure?',
'click'=>'function(){$("#dialogClassroom").dialog("open"); return false;}',
),
'inactivo' => array(
'label' => 'Inactivar',
'url' => 'Yii::app()->controller->createUrl("inactivar",array("id"=>$data->IDIdioma))',
'imageUrl' => Yii::app()->baseUrl.'/images/uncheck.png',
),
),
),
),
)); ?>
If u see the variable $target, i use a $model->IDIdioma that shoulve been $data->IDIdioma but i cannot use that variable, since is not initialized… any suggestion?