S
S
shanik2017-09-12 11:51:44
Yii
shanik, 2017-09-12 11:51:44

How to sort checkboxes in gridview Yii2?

When editing data, there is a gridview in which a row is marked based on the condition

'class' => 'yii\grid\RadioButtonColumn',
                            'radioOptions' => function ($taxon) use ($floraTaxonId) {
                                return [
                                    'value' => $taxon->id,
                                    'checked' => $taxon->id == $floraTaxonId
                                ];
                            }

It is necessary that in the gridview the marked one should be the first, because there can be a lot of data and there is a division into pages. That is, the marked line will be, for example, on the 2nd page, or maybe on the 1000th.
Is it possible?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2017-09-12
@shanik

this cannot be done at the display level, it is necessary to sort the data at the level of the SQL query / data provider

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question