浏览代码

Add selectItemName option.

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

+ 6 - 0
docs/docs.js

@@ -114,6 +114,12 @@ $(function () {
                 type: 'Boolean',
                 type: 'Boolean',
                 description: 'Enable the search input.',
                 description: 'Enable the search input.',
                 'default': 'false'
                 'default': 'false'
+            },
+            {
+                name: 'selectItemName',
+                type: 'String',
+                description: 'The name of radio or checkbox input.',
+                'default': 'btSelectItem'
             }
             }
         ]
         ]
     });
     });

+ 4 - 1
src/bootstrap-table.js

@@ -61,6 +61,7 @@
         pageSize: 10,
         pageSize: 10,
         pageList: [10, 25, 50, 100],
         pageList: [10, 25, 50, 100],
         search: false,
         search: false,
+        selectItemName: 'btSelectItem',
 
 
         onClickRow: function(item) {return false;},
         onClickRow: function(item) {return false;},
         onSort: function(name, order) {return false;},
         onSort: function(name, order) {return false;},
@@ -468,7 +469,9 @@
                     type = that.options.columns[j].radio ? 'radio' : type;
                     type = that.options.columns[j].radio ? 'radio' : type;
 
 
                     text = ['<td>',
                     text = ['<td>',
-                        '<input name="btSelectItem" class="checkbox" data-index="' + i + '"' +
+                            '<input class="checkbox"' +
+                            sprintf(' data-index="%s"', i) +
+                            sprintf(' name="%s"', that.options.selectItemName) +
                             sprintf(' type="%s"', type) +
                             sprintf(' type="%s"', type) +
                             sprintf(' checked="%s"', value ? 'checked' : undefined) + ' />',
                             sprintf(' checked="%s"', value ? 'checked' : undefined) + ' />',
                         '</td>'].join('');
                         '</td>'].join('');