Hi All,
I have the following code:
<?php
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'cp-organisation-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'organisation_name',
'tell_number',
'fax_number',
'web_url',
array(
'header' => '',
'name' => 'tell_number',
'type' => 'raw',
'htmlOptions' => array('style' => 'width: 30px; text-align: center;',),
'filter'=>false,
'value' => 'CHtml::image(
Yii::app()->request->baseUrl . "/images/notes.jpg",
"",
array("style" => "cursor: pointer;",
"title" => "Additional Info",
"onclick" => "javascript: txt = \'$data->organisation_name\';
$(\'#info-dialog\').html(txt);
$(\'#info-dialog\').dialog(\'open\');
$(\'#info-dialog\').click(function() { $(this).dialog(\'close\'); });"
)
)'
),
),
));
$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
'id' => 'info-dialog',
// Additional JavaScript options for the dialog plugin
'options'=>array(
'title' => 'Additional Info',
'autoOpen' => false,
'modal' => true,
'width' => 750,
'height' => 550,
),
));
// No content needed - it will be set by the JavaScript in the grid
$this->endWidget('zii.widgets.jui.CJuiDialog');
?>
As you can see this is a column which has an image in it. When you click on the image, it open a CJuiDialog window and displays more information. The line of code which sets the text to be displayed inside the CJuiDialog is this:
"onclick" => "javascript: txt = \'$data->organisation_name\';
How possible would it be to a Model and passthe id from the record? In other words, I am trying to do something like this:
"onclick" => "javascript: txt = \'Company::model()->getFullInfo($data->id)\';
getFullInfo is a function inside Company model which will return a string value of all information. Is this possible or I missing the point totally and need to do something totally different?
Thanks