Ohhh I got stuck, I need to reinit my progress bars but can't quite get it.
This is my index.php (from view directory):
<?php $this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'afterAjaxUpdate' => 'reinstallProgressBar',
'itemView'=>'_view',
'sortableAttributes'=>array(
'name',
// 'location->location_name'=>'Location',
'idcategory',
),
'template'=>'{sorter}{items}<br style="clear:both"><div style="margin-top:20px !important;>"{pager}{summary}</div>',
'pager' => array('header'=>'',),
'summaryText'=>'',
)); ?>
</div>
<?php echo $this->renderPartial('../layouts/sidebar_cat'); ?>
<?php
Yii::app()->clientScript->registerScript('re-install-progress-bar', "
function reinstallProgressBar(id, data) {
jQuery('#yw1').progressbar({'value':0});
jQuery('#yw2').progressbar({'value':0});
jQuery('#yw3').progressbar({'value':0});
jQuery('#yw4').progressbar({'value':0});
jQuery('#yw5').progressbar({'value':0});
jQuery('#yw6').progressbar({'value':0});
//alert(id);
// alert(data);
}
");
?>
This is my _view.php
<?php
$pb_value=0;
if($data->funding->current_funds <= $data->funding->funding_goal)
{
$pb_value = (($data->funding->current_funds * 100) / $data->funding->funding_goal);
}
else
{
$pb_value=100;
}
$this->widget('zii.widgets.jui.CJuiProgressBar', array(
'value'=>$pb_value,
'htmlOptions'=>array(
'style'=>'height:20px; width:204px; margin:auto; display:block;'
),
));?>
As you can see, my progress bar value is calculated in _view.php file, but afterajaxupdate calls reinstallprogressbar in index.php, and I can not pass values to it in order to correctly reinit progress bars, (they are re-initalised, but I can not get the values, they are all = 0).