Extjs Window用法详解 3 打印具体应用,是否关掉打印预览的界面
Extjs Window用法詳解 3 打印具體應(yīng)用,是否關(guān)掉打印預(yù)覽的界面
Extjs 中的按鈕元素
{
xtype: 'buttongroup',
title: '打印',
items: [
me.tsbDel = Ext.create('Ext.button.Button', {
text: '打印123',
iconCls: 'tool_print',
scale: 'large',
iconAlign: 'top',
handler: function () {
var window = me.createWindow('www.view.report.vwwprint', {
params: {
oid: record.data.id,
}
});
}
}), ]
},
?
Extjs彈窗使用的第一種打印
Ext.define('www.view.report.vwwprint', {
extend: 'www.controls.WinBase',
width: 800,
height: 600,
autoShow: true,
modal: true,
stateful: false,
maximizable: false,
minimizable: false,
resizable: false,
layout: 'fit',
title: '打印的內(nèi)容',
iconCls: 'icon_taskboxlist',
initComponent: function () {
var me = this;
me.items = [
{
xtype: 'panel',
border: 0,
html: '<iframe id="ifPrint" name="ifPrint" src="' + me.url + '' + Ext.Object.toQueryString(me.params) + '" width="100%" height="500" frameborder="0" scrolling="auto"></iframe>'
//html的具體內(nèi)容?
//<iframe id="ifPrint" name="ifPrint" src="./D/Report/VSearchReport/?DateStart=2018-06-03T00%3A00%3A00&DateEnd=2018-07-03T00%3A00%3A00" width="100%" height="500" frameborder="0" scrolling="auto"></iframe>
//調(diào)用的位置以及參數(shù)
handler: function () {
var window = me.createWindow('www.view.report.vreport', {
url: "www/Report/VSearchReport/?",
title: '貴陽銀行中心金額現(xiàn)金收付統(tǒng)計打印表',
params: {
//oid: me.SelectedOID,
//otype: me.SelectedType,
DateStart: me.dpFromDate.getValue(),
DateEnd: me.dpToDate.getValue()
},
listeners: {
//ok: function () {
// me.loadData();
//}
}
});
}
//
}];
me.buttons = [
me.btnOK = Ext.create('Ext.button.Button', {
text: '打印',
handler: function () {
var iframe = document.getElementById('ifPrint');
iframe.contentWindow.focus();
iframe.contentWindow.print();
//me.close();是否關(guān)掉打印預(yù)覽的界面,添加這一句,就會關(guān)掉預(yù)覽界面,不加這一句預(yù)覽界面就會一直存在,簡單說就是該資源是否釋放
}
}),
me.btnCancel = Ext.create('Ext.button.Button', {
text: '關(guān)閉',
handler: function () {
me.close();
}
})];
me.callParent(arguments);
}
});
?
Extjs彈窗使用的第二種打印
?1、html文件
<div id="content"><h2>歡迎訪問起飛網(wǎng)Extjs教程</h2><p>更多Extjs教程,請訪問<a href="http://www.qeefee.com/zt-extjs">http://www.qeefee.com/zt-extjs</a></p> </div>2、 //創(chuàng)建window var win = Ext.create("Ext.window.Window", {id: "myWin",title: "示例窗口",width: 500,height: 300,layout: "fit",autoShow: true,contentEl: "content", items: [ buttons: [{ xtype: "button", text: "確定", handler: function ()
//{
//this.up("window").close();
//}
var iframe = document.getElementById('ifPrint');
iframe.contentWindow.focus();
iframe.contentWindow.print();
},{ xtype: "button", text: "取消", handler: function () { this.up("window").close(); } }] });
?
總結(jié)
以上是生活随笔為你收集整理的Extjs Window用法详解 3 打印具体应用,是否关掉打印预览的界面的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 全程使用 AI 从 0 到 1 写了个小
- 下一篇: Pantheons:用 TypeScri