JS代码
var buttonOnclick1=new Ext.Button({ text:"饼图打印", listeners:{ "click":function(){ var printArea = document.getElementById("div1").innerHTML; var iframe = document.getElementById("printIframe"); iframe.contentWindow.document.body.innerHTML=printArea; iframe.contentWindow.focus(); iframe.contentWindow.print(); } } });
new Ext.Panel({ iconCls: 'chart', title:'<font color="red">按时间段统计处理情况车辆数-饼图</font>', renderTo:'div1', //定义panel渲染位置 anchor: '95%', width:document.body.clientWidth/2-10, height: document.body.clientHeight-30,//定义高度 layout: 'fit', items: { id:'printArea', xtype: 'piechart', store: store, categoryField: 'columnName', dataField: 'columnValue', extraStyle: { legend: { display: 'right', padding: 50, font: { family : 'Tahoma', size: 13 } } }, listeners: { 'beforerender': function(o) { store.load({ params : { time1:time1, time2:time2 } }); } } } });
jsp代码
<table> <tr> <td><div id='div1'></div></td> <td><div id='div2'></div></td> </tr> </table> <iframe id="printIframe" style="width:0px;height:0px;position:absolute;left:-500px;top:-500px;"></iframe>
各位大神们求解呀