Filtered Gridview with BS5 progress bar

Hello there,

I’ve a Gridview with a column that shows a BS5 widget progress bar; this progress bar is based on a ranking value that is calculated over all the records table:

        'attribute' => 'user_name',
		'format' => 'raw',
        'value' => function( $data ) { return( $data->getUser()->count() ? $data->getUser()->one()->description . '<br />' . yii\bootstrap5\Progress::widget( ['percent' => (int) ( 100 * $data->ranking ), 'label' => (string) $data->hits, 'class' => 'pogress-bar'] ) : '-' ); },

So far so good…

I’ve added some filter columns that, of course, restrict the number of rows displayed in the grid. Now, I’d like to update the ranking value, so the progress bar shows the “local” ranking (based on the restricted rows computed from the filters).

Thinking a little, I only need the maximum ranking value of the filtered rows in order to arithmetical compute the others “local” rankings. But I don’t take a clue how I can tap the current filters or pass from the SearchModel the maximum ranking value.

Is there any way to tap the current search parameters from a column?

You want to access search parameters or manipulate parameters?

Just access them from the column value’s function.


Really appreciate your help, Ankit!

1 Like