diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 4d9bb1620c..cb3db25b6a 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -134,6 +134,7 @@ Yii Framework 2 Change Log - Enh: Added param `hideOnSinglePage` to `yii\widgets\LinkPager` (arturf) - Enh: Added support for array attributes in `in` validator (creocoder) - Enh: Improved `yii\helpers\Inflector::slug` to support more cases for Russian, Hebrew and special characters (samdark) +- Enh: ListView now uses the widget ID in the base tag, consistent to gridview (cebe) - Chg #2287: Split `yii\db\ColumnSchema::typecast()` into two methods `phpTypecast()` and `dbTypecast()` to allow specifying PDO type explicitly (cebe) - Chg #2898: `yii\console\controllers\AssetController` is now using hashes instead of timestamps (samdark) - Chg #2913: RBAC `DbManager` is now initialized via migration (samdark) diff --git a/framework/grid/GridView.php b/framework/grid/GridView.php index be34140965..79d426f663 100644 --- a/framework/grid/GridView.php +++ b/framework/grid/GridView.php @@ -219,9 +219,6 @@ class GridView extends BaseListView if (!$this->formatter instanceof Formatter) { throw new InvalidConfigException('The "formatter" property must be either a Format object or a configuration array.'); } - if (!isset($this->options['id'])) { - $this->options['id'] = $this->getId(); - } if (!isset($this->filterRowOptions['id'])) { $this->filterRowOptions['id'] = $this->options['id'] . '-filters'; } diff --git a/framework/widgets/BaseListView.php b/framework/widgets/BaseListView.php index 90a43c724b..213f20b13b 100644 --- a/framework/widgets/BaseListView.php +++ b/framework/widgets/BaseListView.php @@ -101,6 +101,9 @@ abstract class BaseListView extends Widget if ($this->emptyText === null) { $this->emptyText = Yii::t('yii', 'No results found.'); } + if (!isset($this->options['id'])) { + $this->options['id'] = $this->getId(); + } } /**