Answer the question
In order to leave comments, you need to log in
How to programmatically set some checkbox entries in gridview checkbox column in yii2?
Hi all.
That is, we got a list of records in the gridview, I want to select the checkbox for some records from the code.
Answer the question
In order to leave comments, you need to log in
We look at the documentation:
www.yiiframework.com/doc-2.0/yii-grid-checkboxcolu...
there is a parameter - checkboxOptions
'checkboxOptions' => function ($model, $key, $index, $column) {
return ($model->someAttr == 5)?['checked'=>"checked"]:[];
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question