Commit a861994f by Qiang Xue

Fixes #1835: `CheckboxColumn` now renders checkboxes whose values are the…

Fixes #1835: `CheckboxColumn` now renders checkboxes whose values are the corresponding data key values
parent b89cd926
...@@ -67,6 +67,7 @@ Yii Framework 2 Change Log ...@@ -67,6 +67,7 @@ Yii Framework 2 Change Log
- Chg #1643: Added default value for `Captcha::options` (qiangxue) - 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 #1647: Changed the default CSS class of error block to be `error-block` (qiangxue)
- Chg #1796: Removed `yii\base\Controller::getActionParams()` (samdark) - 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 `yii\jui\Widget::clientEventsMap` to `clientEventMap` (qiangxue)
- Chg: Renamed `ActiveRecord::getPopulatedRelations()` to `getRelatedRecords()` (qiangxue) - Chg: Renamed `ActiveRecord::getPopulatedRelations()` to `getRelatedRecords()` (qiangxue)
- Chg: Renamed `attributeName` and `className` to `targetAttribute` and `targetClass` for `UniqueValidator` and `ExistValidator` (qiangxue) - Chg: Renamed `attributeName` and `className` to `targetAttribute` and `targetClass` for `UniqueValidator` and `ExistValidator` (qiangxue)
......
...@@ -75,6 +75,9 @@ class CheckboxColumn extends Column ...@@ -75,6 +75,9 @@ class CheckboxColumn extends Column
$options = call_user_func($this->checkboxOptions, $model, $key, $index, $this); $options = call_user_func($this->checkboxOptions, $model, $key, $index, $this);
} else { } else {
$options = $this->checkboxOptions; $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); return Html::checkbox($this->name, !empty($options['checked']), $options);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment