如何打印ExtJS组件?

Ron*_*Ron 6 extjs

当OK-ed时,如何弹出打印组件的打印对话框?

Gop*_*ini 8

                    var targetElement = Ext.getCmp('PrintablePanelId');
                    var myWindow = window.open('', '', 'width=200,height=100');
                    myWindow.document.write('<html><head>');
                    myWindow.document.write('<title>' + 'Title' + '</title>');
                    myWindow.document.write('<link rel="Stylesheet" type="text/css" href="http://dev.sencha.com/deploy/ext-4.0.1/resources/css/ext-all.css" />');
                    myWindow.document.write('<script type="text/javascript" src="http://dev.sencha.com/deploy/ext-4.0.1/bootstrap.js"></script>');
                    myWindow.document.write('</head><body>');
                    myWindow.document.write(targetElement.body.dom.innerHTML);
                    myWindow.document.write('</body></html>');
                    myWindow.print();
Run Code Online (Sandbox Code Playgroud)

将extjs可打印组件写入文档.


NT3*_*3RP 1

在 ExtJS 中打印并不是特别容易。我发现的关于使组件可打印的最佳资源可以在Sencha 架构师的博客上找到。这篇文章介绍了如何为组件设置自定义打印渲染器,以及有关打印的其他详细信息。但是,此信息适用于 ExtJS 3.x;ExtJS 4 可能使打印变得更容易。