浏览代码

When field is undefined, use index instead

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

+ 3 - 3
docs/examples.html

@@ -179,9 +179,9 @@
                     <table id="table-transform" data-toolbar="#transform-buttons">
                         <thead>
                         <tr>
-                            <th data-field="id">Item ID</th>
-                            <th data-field="name">Item Name</th>
-                            <th data-field="price">Item Price</th>
+                            <th>Item ID</th>
+                            <th>Item Name</th>
+                            <th>Item Price</th>
                         </tr>
                         </thead>
                         <tbody>

+ 2 - 1
src/bootstrap-table.js

@@ -248,7 +248,8 @@
         });
         this.options.columns = $.extend({}, columns, this.options.columns);
         $.each(this.options.columns, function (i, column) {
-            that.options.columns[i] = $.extend({}, BootstrapTable.COLUMN_DEFAULTS, column);
+            that.options.columns[i] = $.extend({}, BootstrapTable.COLUMN_DEFAULTS,
+                {field: i}, column); // when field is undefined, use index instead
         });
 
         // if options.data is setting, do not process tbody data