groupText: ['<input type="checkbox" class="groupHeader" style="top:3px"/>'&nbsp;{1}&nbsp;</span>条 '],

 

 $gridTable.on("change", "input[type=checkbox]", function (e) {
            var currentCB = $(this);
            var grid = $('#gridTable');
            var isChecked = this.checked;
            if (currentCB.is(".groupHeader")) { //if group header is checked, to check all child checkboxes
                var checkboxes = currentCB.closest('tr').nextUntil('tr.gridTableghead_0').find('.cbox[type="checkbox"]');
                checkboxes.each(function () {
                    if (!this.checked || !isChecked)
                        grid.setSelection($(this).closest('tr').attr('id'), true);
                });
            } else {  //when child checkbox is checked
                var allCbs = currentCB.closest('tr').prevAll("tr.gridTableghead_0:first").nextUntil('tr.gridTableghead_0').andSelf().find('[type="checkbox"]');
                var allSlaves = allCbs.filter('.cbox');
                var headerCB = allCbs.filter(".groupHeader");
                var allChecked = !isChecked ? false : allSlaves.filter(":checked").length === allSlaves.length;
                headerCB.prop("checked", allChecked);
            }
        });

 

学习交流群:364976091