CJuiProgressBar顯示一進度條。它封裝了 JUI Progressbar插件。CJuiProgressBar顯示一進度條。它封裝了 JUI Progressbar插件。
<?php $this->widget('zii.widgets.jui.CJuiProgressBar', array(
'id'=>'progress',
'value'=>0,
'htmlOptions'=>array(
'style'=>'width:200px; height:20px; float:left;'
),
));
?>
為了演示進度條,我們使用JavaScripts改變進度條當前值,並使用一個文本顯示當前進度條的值。
<?php
// Dummy function just to provide an example
Yii::app()->clientScript->registerScript('scriptId', "
var count = 0;
var step = 10;
var speed = 500;
function progress() {
$('#amount').text(count+'%');
$('#progress').progressbar('option', 'value', count);
if(count < 100) {
count = count+step;
setTimeout(progress, speed);
}
}
progress();
", CClientScript::POS_LOAD);
?>
...
<center id="amount" style="margin-left:210px; padding:3px;"></center>

本例下載:http://www.imobilebbs.com/download/yii/JuiDialogDemo.zip