浏览代码

Add data-events attribute for support.

zhixin 11 年之前
父节点
当前提交
e86c1092bb
共有 2 个文件被更改,包括 4 次插入1 次删除
  1. 1 1
      docs/docs.js
  2. 3 0
      src/bootstrap-table.js

+ 1 - 1
docs/docs.js

@@ -412,7 +412,7 @@ $(function () {
                 },
                 },
                 {
                 {
                     name: 'events',
                     name: 'events',
-                    attribute: '-',
+                    attribute: 'data-events',
                     type: 'Object',
                     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 />value: the field value. <br />row: the row record data.<br />index: the row index.',
                     'default': 'undefined',
                     'default': 'undefined',

+ 3 - 0
src/bootstrap-table.js

@@ -756,6 +756,9 @@
             if (!events) {
             if (!events) {
                 return;
                 return;
             }
             }
+            if (typeof events === 'string') {
+                events = eval(events);
+            }
             for (var key in events) {
             for (var key in events) {
                 that.$body.find('tr').each(function () {
                 that.$body.find('tr').each(function () {
                     var $tr = $(this),
                     var $tr = $(this),