Extjs Window用法详解 2 打印具体应用
Posted 1175429393wljblog
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Extjs Window用法详解 2 打印具体应用相关的知识,希望对你有一定的参考价值。
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: ‘打印的内容‘,
iconCls: ‘icon_taskboxlist‘,
initComponent: function () {
var me = this;
me.items = [
{
xtype: ‘panel‘,
border: 0,
html: ‘<iframe id="ifPrint" name="ifPrint" src="./D/Box/PrintReport/?‘ + Ext.Object.toQueryString(me.params) + ‘" width="100%" height="540" frameborder="0" scrolling="auto"></iframe>‘
}];
me.buttons = [
me.btnOK = Ext.create(‘Ext.button.Button‘, {
text: ‘打印‘,
handler: function () {
var iframe = document.getElementById(‘ifPrint‘);
iframe.contentWindow.focus();
iframe.contentWindow.print();
}
}),
me.btnCancel = Ext.create(‘Ext.button.Button‘, {
text: ‘关闭‘,
handler: function () {
me.close();
}
})];
me.callParent(arguments);
}
});
Extjs弹窗使用的第二种打印
1、html文件
<div id="content"> <h2>欢迎访问起飞网Extjs教程</h2> <p> 更多Extjs教程,请访问<a href="http://www.qeefee.com/zt-extjs">http://www.qeefee.com/zt-extjs</a> </p> </div>
2、
//创建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(); } } ]
});
以上是关于Extjs Window用法详解 2 打印具体应用的主要内容,如果未能解决你的问题,请参考以下文章