ソースを参照

Update the events column option params.

zhixin 11 年 前
コミット
817640f8c7
3 ファイル変更6 行追加6 行削除
  1. 1 1
      docs/docs.js
  2. 3 3
      docs/examples.html
  3. 2 2
      src/bootstrap-table.js

+ 1 - 1
docs/docs.js

@@ -422,7 +422,7 @@ $(function () {
                     name: 'events',
                     attribute: 'data-events',
                     type: 'Object',
-                    description: 'The cell events listener when you use formatter function, take three parameters: <br />value: the field value. <br />row: the row record data.<br />index: the row index.',
+                    description: 'The cell events listener when you use formatter function, take three parameters: <br />event: the jQuery event. <br />value: the field value. <br />row: the row record data.<br />index: the row index.',
                     'default': 'undefined',
                     example: 'via-javascript-table'
                 },

+ 3 - 3
docs/examples.html

@@ -736,15 +736,15 @@
                                     valign: 'middle',
                                     formatter: operateFormatter,
                                     events: {
-                                        'click .like': function (value, row, index) {
+                                        'click .like': function (e, value, row, index) {
                                             alert('You click like icon, row: ' + JSON.stringify(row));
                                             console.log(value, row, index);
                                         },
-                                        'click .edit': function (value, row, index) {
+                                        'click .edit': function (e, value, row, index) {
                                             alert('You click edit icon, row: ' + JSON.stringify(row));
                                             console.log(value, row, index);
                                         },
-                                        'click .remove': function (value, row, index) {
+                                        'click .remove': function (e, value, row, index) {
                                             alert('You click remove icon, row: ' + JSON.stringify(row));
                                             console.log(value, row, index);
                                         }

+ 2 - 2
src/bootstrap-table.js

@@ -769,12 +769,12 @@
                         el = key.substring(index + 1),
                         func = events[key];
 
-                    $td.find(el).off(name).on(name, function () {
+                    $td.find(el).off(name).on(name, function (e) {
                         var index = $tr.data('index'),
                             row = that.data[index],
                             value = row[that.header.fields[i]];
 
-                        func(value, row, index);
+                        func(e, value, row, index);
                     });
                 });
             }