浏览代码

Fix bugs.

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

+ 0 - 1
docs/examples.html

@@ -318,7 +318,6 @@
                 </table>
             </div>
             <div class="highlight"><pre><code class="language-html"></code></pre></div>
-        </div>
 
             <div>
                 <div class="page-header">

+ 14 - 13
src/bootstrap-table.js

@@ -555,31 +555,32 @@
                     value = eval(that.header.formatters[j] + '(value, item)'); // eval ?
                 }
 
-                value = typeof value === 'undefined' ? that.options.undefinedText : value;
-
-                text = that.options.cardView ?
-                    ['<div class="card-view">',
-                    sprintf('<div class="title" %s>%s</div>', style,
-                        getPropertyFromOther(that.options.columns, 'field', 'title', field)),
-                    sprintf('<div class="value">%s</div>', value),
-                    '</div>'].join('') :
-                    [sprintf('<td %s>', style),
-                    value,
-                    '</td>'].join('');
-
                 if (that.options.columns[j].checkbox || that.options.columns[j].radio) {
                     type = that.options.columns[j].checkbox ? 'checkbox' : type;
                     type = that.options.columns[j].radio ? 'radio' : type;
 
                     text = ['<td>',
-                            '<input class="checkbox"' +
+                        '<input class="checkbox"' +
                             sprintf(' data-index="%s"', i) +
                             sprintf(' name="%s"', that.options.selectItemName) +
                             sprintf(' type="%s"', type) +
                             sprintf(' value="%s"', item[that.options.idField]) +
                             sprintf(' checked="%s"', value ? 'checked' : undefined) + ' />',
                         '</td>'].join('');
+                } else {
+                    value = typeof value === 'undefined' ? that.options.undefinedText : value;
+
+                    text = that.options.cardView ?
+                        ['<div class="card-view">',
+                            sprintf('<div class="title" %s>%s</div>', style,
+                                getPropertyFromOther(that.options.columns, 'field', 'title', field)),
+                            sprintf('<div class="value">%s</div>', value),
+                            '</div>'].join('') :
+                        [sprintf('<td %s>', style),
+                            value,
+                            '</td>'].join('');
                 }
+
                 html.push(text);
             });