Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print ExtJS component?

Tags:

extjs

How do I pop up the Print dialog that will print out a component when OK-ed?

like image 730
Ron Avatar asked May 09 '11 15:05

Ron


1 Answers

                    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();

write your extjs printable component into document.

like image 131
Gopal Saini Avatar answered Oct 13 '22 02:10

Gopal Saini