I am facing an issue with printing data from a grid in JavaScript. The grid contains over 100 records, but when I try to print it using JavaScript, the page header is missing on every page and the final record data is not showing up. Can anyone help me improve this?
self.print();
I use this command to initiate printing:
var gridid = "#grid";
$("#pageheader").show();
$("#pageheader").clone().addClass("clonecopy").appendTo("body");
$(gridid).clone().addClass("clonecopy").appendTo("body");`
The above code is used to print only the Grid on the print screen.
I want to fix this by ensuring that there are only 15 records per page and headers present on every page.
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";
}
}
}
Although I also tried using the above code, I did not get the desired result.