浏览代码

Fix #6241

Print Extension can work with complex objects rather than primitive values
adam.johnson 3 年之前
父节点
当前提交
40394f6adc
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5 3
      src/extensions/print/bootstrap-table-print.js

+ 5 - 3
src/extensions/print/bootstrap-table-print.js

@@ -133,11 +133,13 @@ $.BootstrapTable = class extends $.BootstrapTable {
     })
   }
 
-  doPrint (data) {
-    const formatValue = (row, i, column) => {
+    doPrint(data) {
+      var _this2 = this
+      const formatValue = (row, i, column) => {
+      let value_ = Utils.getItemField(row, column.field, _this2.options.escape, column.escape);
       const value = Utils.calculateObjectValue(column,
         column.printFormatter || column.formatter,
-        [row[column.field], row, i], row[column.field])
+        [value_, row, i], value_)
 
       return typeof value === 'undefined' || value === null ?
         this.options.undefinedText : value