[英]how to add header when page breaks when print using javascript?
i have a Grid which contains more than 100 records at every time.When i am trying to print the data using javascript. 我有一个网格,每次包含100多个记录。当我尝试使用javascript打印数据时。 It able to print the grid data.But my problem is to be in every page not having the page header and at the sametime the final record data is missing .i need to fix this issue anyone help me to improve
它能够打印网格数据。但是我的问题是每个页面都没有页面标题,但同时缺少最终记录数据。我需要解决此问题,任何人都可以帮助我改善
self.print();
i am using this command for initiate print.after that 我正在使用此命令进行初始化打印。
var gridid = "#grid";
$("#pageheader").show();
$("#pageheader").clone().addClass("clonecopy").appendTo("body");
$(gridid).clone().addClass("clonecopy").appendTo("body");`
By this coding used for print only my Grid in print screen. 通过此编码用于仅在打印屏幕上打印我的网格。
and i need to fix this by 15 records per page and headers(for every page) 我需要通过每页15个记录和页眉(每页)来解决此问题
function printControl(){
var table = document.getElementById("DataList1");
var count = table.rows.length;
for (var i = 0; i < count; i++) {
if ((i % 4 == 0)&&(i!=0)) {
table.rows[i].style.cssText = "page-break-after:always";
}
}
}
and also i am using this code but i cant get the result.. 而且我正在使用此代码,但我无法得到结果..
Making a few assumptions here, but it would look similar to below: 在这里做一些假设,但是看起来与下面类似:
var count = 0;
var page = $('<div></div>');
$('#grid').children().each(function(){
if( count == 0 ){
$("#pageheader").clone().addClass("clonecopy").appendTo(page);
}
$(this).clone().addClass("clonecopy").appendTo(page);
count += 1;
if( count == 15 ){
page.appendTo("body");
page = $('<div></div>');
count = 0;
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.