mardi 16 août 2016

Yii2 Progress Widget Clickable Fields

I am trying to make my page display a number of different progress widgets together to form a dynamic bigger progress bar. Each one of the widgets needs to be clickable to take the user to that respective stage. Here is what I have tried so far:

<?php
    $retVal = "";
    $stages = Phases::find()->asArray()->all();
    foreach($stages as $stage)
    {
        $percent = PrjApprovals::percentageComplete($model->id, $stage['phase']);
        echo $retVal = '<div style="float:left; padding-top: 20px;">' .
        Progress::widget
        ([
            'percent' => $percent,
            'label' => $stage['phase'],
            'attributes' => 
                function($model)
                {
                    $url = Url::to(['phases/' . $stage['phase'], 'id' => $model->id]);
                    return ['onclick' => "window.location.href='{$url}'"];
                },
         ]) . '</div>';
    }
?>

I know "attributes" is not right, I've tried barOptions, options, rowOptions and everything else I can find. Still no luck.

I would love for someone to be able to show me where I can find the list of possible options to use for the 'options' =>. I've been looking at http://ift.tt/2aYpn50 with no success.

Thank you for any help!




Aucun commentaire:

Enregistrer un commentaire