In my layout I have a gridview. Once a row in the grid is selected the page should refresh with detailed information about this row. I use renderPartial to render the view that contains the detailed information. But the view never does get refreshed.
I have been searching in the forums and on the internet. And one thing that keeps coming up is the need to set the fourth parameter in the renderPartial method to true. But even with that set, I am still running into the same issues.
I can see in FireBug that the proper output is produced, but the page is not being updated to reflect that.
I hope anybody can help me figure out what I am doing wrong.
Please help!
Here is my code:
Controller code:
public function actionIndex()
{
...
$this->render('index',array(
'dataProvider1'=>$dataProvider1,
'dataProvider2'=>$dataProvider2,
));
}
public function actionList()
{
...
$this->renderPartial('_list', array('dataProvider'=>$dataProvider'), false, true);
}
index view:
<?php $this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataProvider2,
'columns'=>array(
'name',
),
'selectionChanged'=>'function(id) { selectionChanged("'.Yii::app()->baseUrl.'/index.php?r=", $.fn.yiiGridView.getSelection(id))}',
)); ?>
<?php echo $this->renderPartial('_list', array('dataProvider'=>$dataProvider1)); ?>
<script type="text/javascript">
function selectionChanged(baseUrl, id) {
if (id != '')
{
$.post(baseUrl + 'session/list', {id: id[0]});
}
}
</script>
_list view:
<?php $this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'itemView'=>'_view',
)); ?>