-1

我正在寻找是否有任何我可以将打印按钮添加到制表符行,当它被单击时它会打印该特定行?

http://tabulator.info/docs/4.3/print

谢谢

4

1 回答 1

1

没有内置功能,但您可以轻松地将一些东西放在一起来实现这一点。此示例假定每一行都有一个唯一的 id 字段。

您可以使用自定义格式化程序创建一个Button Column,然后使用它将表格过滤到该行,然后打印表格,然后清除过滤器:

//custom formatter definition
var printIcon = function(cell, formatterParams, onRendered){ //plain text value
    return "<i class='fa fa-print'></i>";
};

//column definition in the columns array
{formatter:printIcon, width:40, align:"center", cellClick:function(e, cell){ 

    //filter table to just this row
    table.Filter(function(data){
        return data.id == cell.getData().id;
    });

    //print the table
    table.print();

    //clear the filter
    table.clearFilter();
}},
于 2020-01-19T15:15:51.847 回答