in my merides/create view i have this ajaxLink and an empty <div>
<?php echo CHtml::ajaxLink('Find', $this->createUrl('/person/persongrid',
array('inputField'=>'Merides_senderid')),
array('update'=>'#dialog_ground'),
array('id'=>'senderDialog')); ?>
<div id="dialog_ground" ></div>
which calls this action.
public function actionPersongrid() {
$model=new Person('search');
if( isset($_GET['inputField']) ){
$inputField=$_GET['inputField'];
}
if(isset($_GET['Person'])) {
$attributes = $_GET['Person'];
if( isset( $attributes['myf'] ) ) {
$myf = PersonMyf::model()->findByAttributes(array('myf'=>$attributes['myf']));
if( !empty($myf) )
$attributes['myf'] = $myf->id;
}
$model->attributes=$attributes; }
$this->renderPartial('persongridview',array(
'model'=>$model,
'inputField'=>$inputField,
),false,true);
}
Where the persongridview it is called is this.
<?php $this->beginWidget('zii.widgets.jui.CJuiDialog', array(
'id'=>'personsdialog',
// additional javascript options for the dialog plugin
'options'=>array(
'title'=>'Person dialog',
'autoOpen'=>true,
'modal'=>false,
'width'=>'auto',
))
);
$dp = $model->search();
$dp->keyAttribute='personid';
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'person-grid',
'dataProvider'=>$dp,
'filter'=>$model,
'columns'=>array(
array(
'name'=>'personid',
'value'=>'$data->personid',
//'visible'=>false,
),
'personid',
'fullname',
'afm',
'vat',
array(
'name'=>'myf',
'value'=>'$data->fk_myf->myf',
)
/*
'type',
'indate',
'saler',
'email',
'customerlgl',
'supplierlgl',
'jid',
*/
),
));?>
<div class="row button" align="right">
<?php echo CHtml::ajaxButton('Select','',
array('success'=>'js:function() {
var p_sel = $.fn.yiiGridView.getSelection("person-grid");
if ( p_sel != "") {
$("#personsdialog").dialog("close");
$("#'.$inputField.'").val(p_sel);
}
}'),array('id'=>'selectButton'));
?>
</div>
<?php $this->endWidget('zii.widgets.jui.CJuiDialog');
The issue i am facing is this…Image
Check where is the pointer…The return of the CJuiDialog are not in the div as i set to update but outside of it…this will have conflicts when i will try to get a CJuiDialog for a second time …etc