//按鈕【按鈕一】的回調(diào)
tid = $(layero).find("[name=tid]").val();
for(i=0;i<res.data.length;i++){
if(res.data[i].id==tid){
customPrintJson = JSON.parse(res.data[i].text);
}
}
hiprintTemplate = new hiprint.PrintTemplate({
template: customPrintJson,
});
//表格追加行,先編輯打印元素,找到表格(tableCustom),然后給表格追加(return)行,行可以自行合并以及統(tǒng)計數(shù)據(jù)。
for (i = 0; i<hiprintTemplate.printPanels.length;i++) {
for (j = 0; j<hiprintTemplate.printPanels[i].printElements.length;j++) {
if(hiprintTemplate.printPanels[i].printElements[j].printElementType.type=="tableCustom"){
hiprintTemplate.printPanels[i].printElements[j].printElementType.footerFormatter = function(options,rows,data,currentPageGridRowsData){
total_price = 32;
return "<tr><td colspan='3'>合計</td><td colspan='2'>"+total_price+"元</td></tr>"
};
}
}
}
hiprintTemplate.printPanels
//console.log(hiprintTemplate)
hiprintTemplate.print(printData);