ソースを参照

Fix #672

Column Fixed Width in Percentage Problem
Dennis Hernández 10 年 前
コミット
62a92ec47c
1 ファイル変更2 行追加3 行削除
  1. 2 3
      src/bootstrap-table.js

+ 2 - 3
src/bootstrap-table.js

@@ -473,19 +473,18 @@
                 return;
             }
 
-            if (column.width !== undefined) {
+            if (column.width !== undefined && (!that.options.cardView)) {
                 if (typeof column.width === 'string') {
                     if (column.width.indexOf('%') > -1) {
                         unitWidth = '%'
                     }
-                    column.width = column.width.replace('%', '').replace('px', '');
                 }
             }
 
             halign = sprintf('text-align: %s; ', column.halign ? column.halign : column.align);
             align = sprintf('text-align: %s; ', column.align);
             style = sprintf('vertical-align: %s; ', column.valign);
-            style += sprintf('width: %s'+ unitWidth +'; ', column.checkbox || column.radio ? 36 : column.width);
+            style += sprintf('width: %s'+ unitWidth +'; ', column.checkbox || column.radio ? 36 : column.width.replace('%', '').replace('px', ''));
 
             visibleColumns.push(column);
             that.header.fields.push(column.field);