浏览代码

Fixed checkbox display bug when using formatter (#5474)

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

+ 4 - 2
src/bootstrap-table.js

@@ -1559,8 +1559,10 @@ class BootstrapTable {
       value = Utils.calculateObjectValue(column,
         this.header.formatters[j], [value_, item, i, field], value_)
 
-      value = typeof value === 'undefined' || value === null ?
-        this.options.undefinedText : value
+      if (!(column.checkbox || column.radio)) {
+        value = typeof value === 'undefined' || value === null ?
+          this.options.undefinedText : value
+      }
 
       if (this.searchText !== '' && this.options.searchHighlight) {
         value = Utils.calculateObjectValue(column, column.searchHighlightFormatter, [value, this.searchText], value.toString().replace(new RegExp(`(${ this.searchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') })`, 'gim'), '<mark>$1</mark>'))