I am using an ajax timer to refresh screen data. It appears, however, that the bitmaps get overdrawn instead of redrawn causing additional memory to get consumed at every refresh. I am just trying to find out what the proper method of doing this would be to get around this issue.
<?php
$url = Yii::app()->createUrl(‘tekmanager/tekmanagerrefresh’);
?>
—Timer Function
<script type="text/javascript">
timeout = 5000;
function refresh(){
<?php
echo CHtml::ajax(array(
'url'=>$url,
'type'=>'post',
'update'=>'#tree',
'data'=>array('view'=>'js:jQuery("#id_viewList").val()'),
))
?>
}
$(window).load(function(){
window.setInterval("refresh()",timeout);
});
</script>
—Controller Refresh function—
public function actionTekManagerRefresh(){
$model = new TekManagerForm();
$data = $model->getTreeData();
$data['treeData'] = $this->getDataFormatted($data['Campus'],0);
$view = $_POST['view'];
$data['view'] = $view;
$data['gridData'] = $model->getViewData($view,'ALL');
$this->renderPartial('/site/_tree', array('refreshData'=>$data), false, true);
}
—/site/_tree.php—
<h3>Project</h3>
<?php
$this->widget('CTreeView', array(
'id'=>'tree',
'data'=>$refreshData['treeData'],
'collapsed'=>false,
'htmlOptions'=>array( 'class'=>'treeview-black','href'=>'#'))
);
$arrayDataProvider=new CArrayDataProvider($refreshData['gridData']['viewData'], array(
'id'=>'id',
'pagination'=>array(
'pageSize'=>10,
),
));
$this->widget(‘zii.widgets.grid.CGridView’,
array(
'id'=>'view',
'dataProvider'=>$arrayDataProvider,
'columns'=>$refreshData['gridData']['columnData'],
));
?>