From a861994f197ce49c139d2c3f726a7c4e24fdca44 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Wed, 8 Jan 2014 10:48:16 -0500 Subject: [PATCH] Fixes #1835: `CheckboxColumn` now renders checkboxes whose values are the corresponding data key values --- framework/CHANGELOG.md | 1 + framework/yii/grid/CheckboxColumn.php | 3 +++ 2 files changed, 4 insertions(+) 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); }