在 devexpress 网格中导出文件时如何删除缓存数据?

问题描述 投票:0回答:0

我的问题是,当我第二次或第三次导出网格中的一行数据时,数据会增加一倍或三倍等。它不会增加页面,但在一页上,行会增加。例如,如果我将一行导出 3 次,则一页上将有 3 行,而无论导出多少次,应该始终只有 1 行。因此,在文件 A 的项目中,我调用 createExportPdf 方法并创建一个新的 jsPDF 对象作为参数。 createExportPdf 方法的定义位于文件 B (app.ts) 中,在该方法中它调用 exportPdf,并将之前创建的 jsPDF 对象传递给该导出对象。

项目中的某个地方:

createExportPdf (new jsPDF({
                    orientation:"landscape",
                    unit: "px",
                    format: "a2"
                })

然后在 app.ts 中 createExportPdf 的定义中,我像这样调用 exportPdf 方法:

 createExportPdf(doc?) {
      onClick(e) {
           exportPdf(doc);
      }
}

并在exportPdf定义中:

export function exportPdf(doc?){
if (!doc) {
    doc = new jsPDF({
        orientation: "portrait",
        unit: "px",
        format: "a4"
    })
}  /*If you have not created a new JsPDF object in file A then create one*/

    doc.setFontSize(8);
    doc.setLineHeightFactor(1);
    doc.setDisplayMode("fullheight");



    doc.save(`file.pdf`);
});

}

typescript devexpress jspdf export-to-pdf devexpress-gridcontrol
© www.soinside.com 2019 - 2024. All rights reserved.