diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 447627b..fd00fcd 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -67,6 +67,7 @@ Yii Framework 2 Change Log - Chg #1643: Added default value for `Captcha::options` (qiangxue) - Chg #1647: Changed the default CSS class of error block to be `error-block` (qiangxue) - Chg #1796: Removed `yii\base\Controller::getActionParams()` (samdark) +- Chg #1835: `CheckboxColumn` now renders checkboxes whose values are the corresponding data key values (qiangxue) - Chg: Renamed `yii\jui\Widget::clientEventsMap` to `clientEventMap` (qiangxue) - Chg: Renamed `ActiveRecord::getPopulatedRelations()` to `getRelatedRecords()` (qiangxue) - Chg: Renamed `attributeName` and `className` to `targetAttribute` and `targetClass` for `UniqueValidator` and `ExistValidator` (qiangxue) diff --git a/framework/yii/grid/CheckboxColumn.php b/framework/yii/grid/CheckboxColumn.php index 6970d4b..bf6bcef 100644 --- a/framework/yii/grid/CheckboxColumn.php +++ b/framework/yii/grid/CheckboxColumn.php @@ -75,6 +75,9 @@ class CheckboxColumn extends Column $options = call_user_func($this->checkboxOptions, $model, $key, $index, $this); } else { $options = $this->checkboxOptions; + if (!isset($options['value'])) { + $options['value'] = is_array($key) ? json_encode($key) : $key; + } } return Html::checkbox($this->name, !empty($options['checked']), $options); }