Hi guys,
Via an AjaxButton I re-render the content of a partial view file called _Xview.php (without refreshing the entire site…)
When the _Xview.php view gets re-rendered the success Message shows up… However the success message doesn’t fade out (via javascript). It stays forever.
Why doesn’t it fade out? The code used works in other views where the entire site is refreshed?
Here is the Controller Code…
...
....
Yii::app()->user->setFlash('success',"THX we got your vote..");
$this->renderPartial('../like/_Xview',array('model'=>$model));
Here is the Code of the _Xview.php view that gets called via partialRender() from my Controller:
<?php if(Yii::app()->user->hasFlash('success')):?>
<div class="flash-success">
<?php echo Yii::app()->user->getFlash('success'); ?>
</div>
<?php endif; ?>
<?php
Yii::app()->clientScript->registerScript(
'myHideEffect',
'$(".flash-success").animate({opacity: 1.0}, 3000).fadeOut("slow");',
CClientScript::POS_READY
);
?>
..<img src="imagefilledrectangle.png">..<br>
Here is the code where the partial view file is embedded in:
$this->menu=array(
array('label'=>'List image', 'url'=>array('index')),
array('label'=>'Create image', 'url'=>array('create')),
array('label'=>'Update image', 'url'=>array('update', 'id'=>$model->idImage)),
array('label'=>'Delete image', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->idImage),'confirm'=>'Are you sure you want to delete this item?')),
array('label'=>'Manage image', 'url'=>array('admin')),
);
?>
<h1><?php echo $model->titel; ?></h1>
<div id="data">
<?php $this->renderPartial('../like/_Xview.php',array('model'=>$model)); ?>
</div>
other Stuff..