0

I need to add new column in to grid view that not included in the database. and I don't need to send data that insert to that column to the database. how i need to do that in yii2 php framework explain it step by step.

4

1 回答 1

1

There is built-in column for this purpose. It's called CheckboxColumn and can be added to all columns like that:

'columns' => [
    // ...
    [
        'class' => 'yii\grid\CheckboxColumn',
        // you may configure additional properties here
    ],
],

To get selected rows use the following javascript code:

var keys = $('#grid').yiiGridView('getSelectedRows');
// keys is an array consisting of the keys associated with the selected rows
于 2015-04-01T09:21:28.970 回答