ソースを参照

Fix #149: Hide empty data on Card view when smartDisplay is set to true.

zhixin 11 年 前
コミット
c5ea3c99c4
1 ファイル変更7 行追加1 行削除
  1. 7 1
      src/bootstrap-table.js

+ 7 - 1
src/bootstrap-table.js

@@ -942,7 +942,8 @@
                             ' />',
                             ' />',
                         '</td>'].join('');
                         '</td>'].join('');
                 } else {
                 } else {
-                    value = typeof value === 'undefined' ? that.options.undefinedText : value;
+                    value = typeof value === 'undefined' || value === null ?
+                        that.options.undefinedText : value;
 
 
                     text = that.options.cardView ?
                     text = that.options.cardView ?
                         ['<div class="card-view">',
                         ['<div class="card-view">',
@@ -953,6 +954,11 @@
                         [sprintf('<td%s %s %s>', id_, class_, style),
                         [sprintf('<td%s %s %s>', id_, class_, style),
                             value,
                             value,
                             '</td>'].join('');
                             '</td>'].join('');
+
+                    // Hide empty data on Card view when smartDisplay is set to true.
+                    if (that.options.cardView && that.options.smartDisplay && value === '') {
+                        text = '';
+                    }
                 }
                 }
 
 
                 html.push(text);
                 html.push(text);