zoukankan      html  css  js  c++  java
  • Extjs Window用法详解 3 打印具体应用,是否关掉打印预览的界面

    Extjs Window用法详解 3 打印具体应用,是否关掉打印预览的界面

     

    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',
    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="' + me.url + '' + Ext.Object.toQueryString(me.params) + '" width="100%" height="500" frameborder="0" scrolling="auto"></iframe>'

    //html的具体内容 

    //<iframe id="ifPrint" name="ifPrint" src="./D/Report/VSearchReport/?DateStart=2018-06-03T00%3A00%3A00&amp;DateEnd=2018-07-03T00%3A00%3A00" width="100%" height="500" frameborder="0" scrolling="auto"></iframe>

    //调用的位置以及参数

    handler: function () {
    var window = me.createWindow('www.view.report.vreport', {
    url: "www/Report/VSearchReport/?",
    title: '贵阳银行中心金额现金收付统计打印表',
    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();是否关掉打印预览的界面,添加这一句,就会关掉预览界面,不加这一句预览界面就会一直存在,简单说就是该资源是否释放
    }
    }),
    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: "示例窗口",
         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(); } } ]
    });
  • 相关阅读:
    day12 bash中的if、for
    day11 grep正则匹配
    day10 nfs服务,nginx负载均衡,定时任务
    SpringMVC11文件上传
    SpringMVC10数据验证
    SpringMVC09异常处理和类型转化器
    SpringMVC08转发和重定向
    SpringMVC07处理器方法的返回值
    SpringMVC06以对象的方式获取前台的数据
    SpringMVC05使用注解的方式
  • 原文地址:https://www.cnblogs.com/1175429393wljblog/p/9259526.html
Copyright © 2011-2022 走看看