制表符:打印输出功能不会打印出表格中的进度条

时间:2019-08-29 05:17:26

标签: javascript tabulator

我正在使用Tabulator创建表并添加一个按钮以打印出该表,但是,当我单击该按钮时,它显示了我表中的进度条并没有显示在打印结果上。有谁知道我为什么不能打印进度条?谢谢。

var tabledata = [{
    id: 1,
    name: "postp_ckmb_ngml_group_>=5.6",
    confidence: "1.08",
    acceptable: "true"
  },
  {
    id: 2,
    name: "pci_status_cd_急诊",
    confidence: "1.05",
    acceptable: "true"
  },
  {
    id: 3,
    name: "conclision_angiography_type_冠脉三支病变",
    confidence: "1.01",
    acceptable: "true"
  },
  {
    id: 4,
    name: "pci_indication_cd_STEMI的紧急PCI治疗",
    confidence: "0.89",
    acceptable: "true"
  },
  {
    id: 5,
    name: "postp_bnp_pnml_group_>500",
    confidence: "0.82",
    acceptable: "true"
  },
  {
    id: 6,
    name: "postp_bnp_pnml_group_100-500",
    confidence: "0.82",
    acceptable: "true"
  },
  {
    id: 7,
    name: "cad_presentation_cd_STEMI(7天)",
    confidence: "0.79",
    acceptable: "true"
  },
  {
    id: 8,
    name: "pci_status_cd_早期",
    confidence: "0.64",
    acceptable: "true"
  },
  {
    id: 9,
    name: "cad_presentation_cd_Non-STEMI(7天)",
    confidence: "0.61",
    acceptable: "true"
  },
  {
    id: 10,
    name: "if_pior_cvd_1.0",
    confidence: "0.37",
    acceptable: "true"
  }
];


const table = new Tabulator("#tableContainer", {
  data: tabledata,
  height: "292px",
  layout: "fitColumns",
  printAsHtml: true,
  printCopyStyle: true,
  printHeader: "<h3>Feature Selection Results<h3>",
  columns: [{
      title: "",
      field: "id",
      width: 50
    },
    {
      title: "Feature",
      field: "name"
    },
    {
      title: "Confidence",
      field: "confidence",
      sorter: "number",
      align: "left",
      formatter: "progress",
      width: 400,
      formatterParams: {
        mix: 0,
        max: 1.1,
        color: ["#296FAB"],
        legend: true,
        legendColor: "#333333",
        legendAlign: "right"
      }
    },
    {
      title: "Acceptability",
      field: "acceptable",
      align: "center",
      editor: true,
      sorter: "boolean",
      formatter: "tickCross",
      width: 150
    },
  ],
});



const printTable = () => {
  table.print(false, true);

}
<script src="https://unpkg.com/tabulator-tables@4.3.0/dist/js/tabulator.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/tabulator/4.3.0/css/tabulator.min.css" rel="stylesheet" />
<button onclick="printTable()">Print

</button>
<div id="tableContainer"></div>

我想使用“打印出”按钮来打印出包括进度条在内的整个表格。

1 个答案:

答案 0 :(得分:0)

这是对原始Tabulator打印系统的限制,该系统只能处理基于文本的格式化程序

从2020年中发布的4.6版开始,打印图形格式程序应该没有问题