浏览代码

Added field parameter in the click and dbl-click row event

Dennis Hernández 9 年之前
父节点
当前提交
7a990c95ca

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

@@ -48,7 +48,8 @@ $('#table').on('event-name.bs.table', function (e, arg1, arg2, ...) {
         <td>
         Fires when user click a row, the parameters contain: <br>
         row: the record corresponding to the clicked row, <br>
-        $element: the tr element.
+        $element: the tr element, <br>
+        field: the field name corresponding to the clicked cell.
         </td>
     </tr>
     <tr>
@@ -58,7 +59,8 @@ $('#table').on('event-name.bs.table', function (e, arg1, arg2, ...) {
         <td>
         Fires when user double click a row, the parameters contain: <br>
         row: the record corresponding to the clicked row, <br>
-        $element: the tr element.
+        $element: the tr element, <br>
+        field: the field name corresponding to the clicked cell.
         </td>
     </tr>
     <tr>

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

@@ -33,7 +33,8 @@
         <td>
         Se ejecuta cuando el usuario le da click a una fila, los parámetros contienen: <br>
         row: el registro que corresponde con la fila a la que se le dio click, <br>
-        $element: el elemento tr.
+        $element: el elemento tr, <br>
+        field: el nombre del campo correspondiente a la celda hecho clic.
         </td>
     </tr>
     <tr>
@@ -43,7 +44,8 @@
         <td>
         Se ejecuta cuando el usuario le da click a una fila, los parámetros contienen: <br>
         row: el registro que corresponde con la fila a la que se le dio click, <br>
-        $element: el elemento tr.
+        $element: el elemento tr, <br>
+        field: el nombre del campo correspondiente a la celda hecho clic.
         </td>
     </tr>
     <tr>

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

@@ -34,7 +34,8 @@
         <td>
         当用户点击某一行的时候触发,参数包括:<br>
         row:点击行的数据,<br>
-        $element:tr 元素。
+        $element:tr 元素,<br>
+        field:点击列的 field 名称。
         </td>
     </tr>
     <tr>
@@ -44,7 +45,8 @@
         <td>
         当用户双击某一行的时候触发,参数包括:<br>
         row:点击行的数据,<br>
-        $element:tr 元素。
+        $element:tr 元素,<br>
+        field:点击列的 field 名称。
         </td>
     </tr>
     <tr>

+ 2 - 2
src/bootstrap-table.js

@@ -1785,7 +1785,7 @@
                 $tr = $td.parent(),
                 item = that.data[$tr.data('index')],
                 index = $td[0].cellIndex,
-                field = that.header.fields[that.options.detailView && !that.options.cardView ? index - 1 : index],
+                field = that.getVisibleFields()[that.options.detailView && !that.options.cardView ? index - 1 : index],
                 column = that.columns[getFieldIndex(that.columns, field)],
                 value = getItemField(item, field, that.options.escape);
 
@@ -1794,7 +1794,7 @@
             }
 
             that.trigger(e.type === 'click' ? 'click-cell' : 'dbl-click-cell', field, value, item, $td);
-            that.trigger(e.type === 'click' ? 'click-row' : 'dbl-click-row', item, $tr);
+            that.trigger(e.type === 'click' ? 'click-row' : 'dbl-click-row', item, $tr, field);
 
             // if click to select - then trigger the checkbox/radio click
             if (e.type === 'click' && that.options.clickToSelect && column.clickToSelect) {