S
S
Sergey Melnikov2015-07-08 13:28:52
Yii
Sergey Melnikov, 2015-07-08 13:28:52

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

2 answer(s)
S
sillusi0nsx, 2015-07-16
@sillusi0nsx

There is, for example
demos.krajee.com/grid-demo

M
Maxim Timofeev, 2017-01-12
@webinar

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"]:[];
}

or the registerClientScript () method through which you can throw js, which mark the necessary

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question