浏览代码

Add a new parameter on the check, uncheck events

Dennis Hernández 10 年之前
父节点
当前提交
5b5a51ec48

+ 4 - 2
docs/_i18n/en/documentation/events.md

@@ -84,19 +84,21 @@
     <tr>
         <td>onCheck</td>
         <td>check.bs.table</td>
-        <td>row</td>
+        <td>row, $element</td>
         <td>
         Fires when user check a row, the parameters contain: <br>
         row: the record corresponding to the clicked row.
+        $element: the DOM element checked.
         </td>
     </tr>
     <tr>
         <td>onUncheck</td>
         <td>uncheck.bs.table</td>
-        <td>row</td>
+        <td>row, $element</td>
         <td>
         Fires when user uncheck a row, the parameters contain: <br>
         row: the record corresponding to the clicked row.
+        $element: the DOM element unchecked.
         </td>
     </tr>
     <tr>

+ 2 - 0
docs/_i18n/es/documentation/events.md

@@ -87,6 +87,7 @@
         <td>
         Se ejecuta cuando el usuario chequea una fila, los parámetros contienen: <br>
         row: el registro que corresponde a la fila chequeada.
+        $element: el elemento DOM chequeado.
         </td>
     </tr>
     <tr>
@@ -96,6 +97,7 @@
         <td>
         Se ejecuta cuando el usuario des-chequea una fila, los parámetros contienen: <br>
         row: el registro que corresponde a la fila deschequeada.
+        $element: el elemento DOM deschequeado.
         </td>
     </tr>
     <tr>

+ 2 - 0
docs/_i18n/zh-cn/documentation/events.md

@@ -88,6 +88,7 @@
         <td>
         Fires when user check a row, the parameters contains: <br>
         row: the record corresponding to the clicked row.
+        $element: the DOM element checked.
         </td>
     </tr>
     <tr>
@@ -97,6 +98,7 @@
         <td>
         Fires when user uncheck a row, the parameters contains: <br>
         row: the record corresponding to the clicked row.
+        $element: the DOM element unchecked.
         </td>
     </tr>
     <tr>

+ 4 - 3
src/bootstrap-table.js

@@ -1598,8 +1598,9 @@
         this.$selectItem.off('click').on('click', function (event) {
             event.stopImmediatePropagation();
 
-            var checked = $(this).prop('checked'),
-                row = that.data[$(this).data('index')];
+            var $this = $(this),
+                checked = $this.prop('checked'),
+                row = that.data[$this.data('index')];
 
             row[that.header.stateField] = checked;
 
@@ -1611,7 +1612,7 @@
             }
 
             that.updateSelected();
-            that.trigger(checked ? 'check' : 'uncheck', row);
+            that.trigger(checked ? 'check' : 'uncheck', row, $this);
         });
 
         $.each(this.header.events, function (i, events) {