From dab2b03f0939a0c531ed1019d6a0a5c1cfec8806 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sun, 9 Nov 2014 03:02:18 +0300 Subject: [PATCH] Fixes #5863: Selecting all individual `yii\grid\CheckboxColumn` checkboxes in grid view wasn't resulting in "all" checkbox selected --- framework/CHANGELOG.md | 1 + framework/assets/yii.gridView.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 080af13..8638ee3 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -20,6 +20,7 @@ Yii Framework 2 Change Log - Bug #5768: When setting `data-confirm` attribute to a submit button, clicking on the button would not trigger form submission (qiangxue) - Bug #5780: `QueryBuilder::batchInsert()` may cause "undefined index" error (qiangxue) - Bug #5833: The `message` command fails with a FK constraint error when trying to update messages (qiangxue) +- Bug #5863: Selecting all individual `yii\grid\CheckboxColumn` checkboxes in grid view wasn't resulting in "all" checkbox selected (samdark) - Bug #5893: `yii\helpers\ArrayHelper::toArray()` now applies `$properties` parameter for converting descending objects in recursive calls (otsec) - Bug #5925: `ArrayHelper::htmlEncode()` does not work properly when the value being encoded is a nested array (tebazil) - Bug: Gii console command help information does not contain global options (qiangxue) diff --git a/framework/assets/yii.gridView.js b/framework/assets/yii.gridView.js index 2bdd596..6f7e6e8 100644 --- a/framework/assets/yii.gridView.js +++ b/framework/assets/yii.gridView.js @@ -122,8 +122,9 @@ if (!options.multiple) { return; } - var inputs = "#" + id + " input[name='" + options.checkAll + "']"; - $(document).off('click.yiiGridView', inputs).on('click.yiiGridView', inputs, function () { + var checkAll = "#" + id + " input[name='" + options.checkAll + "']"; + var inputs = "#" + id + " input[name='" + options.name + "']"; + $(document).off('click.yiiGridView', checkAll).on('click.yiiGridView', checkAll, function () { $grid.find("input[name='" + options.name + "']:enabled").prop('checked', this.checked); }); $(document).off('click.yiiGridView', inputs + ":enabled").on('click.yiiGridView', inputs + ":enabled", function () {