Skip to content

Commit f388ca7

Browse files
authored
Fix #18867: Check-all checkbox should be unchecked on page load when GridView have no rows (#19764)
1 parent e8bf240 commit f388ca7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

framework/assets/yii.gridView.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,9 @@
198198
$grid.find(checkAllInput + (all ? ":not(:checked)" : ":checked")).prop('checked', all).change();
199199
};
200200
initEventHandler($grid, 'checkRow', 'click.yiiGridView', "#" + id + " " + inputs, handler);
201-
handler(); // Ensure "check all" checkbox is checked on page load if all data row checkboxes are initially checked.
201+
if($grid.find(inputs).length) {
202+
handler(); // Ensure "check all" checkbox is checked on page load if all data row checkboxes are initially checked.
203+
}
202204
},
203205

204206
getSelectedRows: function () {

0 commit comments

Comments
 (0)