Browse Source

Fixes #1835: `CheckboxColumn` now renders checkboxes whose values are the corresponding data key values

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
a861994f19
  1. 1
      framework/CHANGELOG.md
  2. 3
      framework/yii/grid/CheckboxColumn.php

1
framework/CHANGELOG.md

@ -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)

3
framework/yii/grid/CheckboxColumn.php

@ -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);
} }

Loading…
Cancel
Save