This is an extension to my previous question. I’ve successfully added a button to my php web page which works fine by printing all the graphs in the page at once. I’ve done the following way
function printdiv(printpage)
{
var headstr = '<html><head><title>Graphs</title></head>'+'<link rel="stylesheet" type="text/css" href="../css/template.css" />'+'<body><br/><br/><br/>';
var footstr = "</body>";
var newstr = document.all.item(printpage).innerHTML;
var oldstr = document.body.innerHTML;
document.body.innerHTML = headstr+newstr+footstr;
window.print();
document.body.innerHTML = oldstr;
return false;
die();
}
<input name="b_print" type="button" class="ipt" onClick="printdiv('graphs');" value="Graphs">
One issue i have now is, when i click the print button the preview pops up, once the printing is done, all the highcharts in that page become inactive (say when i move the cursor over the chart it and try to do something it doesnt respond until i refresh the page). Any clue whats happening here?
Thanks in advance
As you have changed innerHTML, all the event listeners (to handle use interactions with your chart in this case,) have been removed at the same time.
You can try to generate a popup window to place your
headstr+newstr+footstr, or use a more elegant approach, such as CSS media selector, to prevent this problem.