I have a requirement of displaying the Progress Bar in DetailView widget. I searched for it but I got solutions for GridView widget. So that I tried modifying it but didn't work as expected.
<?=DetailView::widget(
[
'model' => $model,
'attributes' =>
[
[
'attribute' => 'progress',
'label' => 'Activity Progress',
'type' => DetailView::INPUT_WIDGET,
'class' => 'yii\bootstrap\Progress',
'widgetOptions' =>
[
'percent' => 50,
'barOptions' => ['class' => 'progress-bar-info'],
'options' => ['id' => 'progBar', 'class' => 'active progress-striped']
]
]
]
]
)
?>
You need to simply set the column
formattorawand return the widget output from thevalueoption simple as that see below I used theyii\bootstrap\Progresswidget within theDetailViewIf you have a field in the database with the name
progressthat holds the current progress of the row in integer format you can pass$model->progressto thepercentoption in theyii\bootstrap\Progresswidget like"percent"=>$model->progress.