|
89 | 89 | // Cycle through each checkbox found on the table.
|
90 | 90 | $checkboxes.each(function() {
|
91 | 91 | var $checkbox = $(this),
|
92 |
| - $row = $checkbox.parents('tr'); |
| 92 | + $row = $checkbox.parents('tr'), |
| 93 | + $inbetween, |
| 94 | + $allRows; |
93 | 95 | $checkbox.on('change', function(e, isInternal) {
|
94 | 96 | // When the user clicks directly on the rows he will unwillingly select
|
95 | 97 | // the text of all rows inbetween. Remove that selection immediately.
|
|
103 | 105 | $inbetween.find(_private.config.checkboxSelector)
|
104 | 106 | .prop('checked', _private.config.isChecked($checkbox))
|
105 | 107 | .trigger('change', [true]);
|
| 108 | + $allRows = $inbetween.add($row, $lastRow); |
106 | 109 | // Trigger table level event.
|
107 | 110 | $table.trigger(
|
108 |
| - _private.config.isChecked($checkbox) |
109 |
| - ? 'multirowselect' |
110 |
| - : 'multirowdeselect' |
| 111 | + _private.config.isChecked($checkbox) ? 'multirowselect' : 'multirowdeselect', |
| 112 | + { |
| 113 | + $rows: $allRows, |
| 114 | + $checkboxes: $allRows.find(_private.config.checkboxSelector), |
| 115 | + rowcount: $allRows.length |
| 116 | + } |
111 | 117 | );
|
112 | 118 | }
|
113 | 119 | $lastRow = $row;
|
114 | 120 | $row.toggleClass(_private.config.selectedRowClass, _private.config.isChecked($checkbox));
|
115 | 121 | // Trigger row level event.
|
116 |
| - $row.trigger(_private.config.isChecked($checkbox) ? 'rowselect' : 'rowdeselect'); |
| 122 | + $row.trigger( |
| 123 | + _private.config.isChecked($checkbox) ? 'rowselect' : 'rowdeselect', |
| 124 | + {$row: $row,$checkbox: $checkbox} |
| 125 | + ); |
117 | 126 | });
|
118 | 127 | // Monitor the row and check the checkbox accordingly.
|
119 | 128 | $row.on('click', function(e) {
|
|
0 commit comments