Skip to content

Commit 136cd9d

Browse files
committed
#1 Implemented data for events
1 parent 263ccfd commit 136cd9d

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules/
22
npm-debug.log
3+
index.html

jquery.tablecheckbox.js

+14-5
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@
8989
// Cycle through each checkbox found on the table.
9090
$checkboxes.each(function() {
9191
var $checkbox = $(this),
92-
$row = $checkbox.parents('tr');
92+
$row = $checkbox.parents('tr'),
93+
$inbetween,
94+
$allRows;
9395
$checkbox.on('change', function(e, isInternal) {
9496
// When the user clicks directly on the rows he will unwillingly select
9597
// the text of all rows inbetween. Remove that selection immediately.
@@ -103,17 +105,24 @@
103105
$inbetween.find(_private.config.checkboxSelector)
104106
.prop('checked', _private.config.isChecked($checkbox))
105107
.trigger('change', [true]);
108+
$allRows = $inbetween.add($row, $lastRow);
106109
// Trigger table level event.
107110
$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+
}
111117
);
112118
}
113119
$lastRow = $row;
114120
$row.toggleClass(_private.config.selectedRowClass, _private.config.isChecked($checkbox));
115121
// 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+
);
117126
});
118127
// Monitor the row and check the checkbox accordingly.
119128
$row.on('click', function(e) {

jquery.tablecheckbox.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)