PDA

View Full Version : Converting Grid to HTML to display in a printer friendly screen



prijithkr
4 Oct 2012, 6:04 AM
I tried this, but it returns that the body.dom is NULL, any other suggestion?




var gLSGrid=Ext.create('Ext.grid.Panel', {
store: gLSStore,
id:'gLSGrid',
height: 280,
overflowY:'auto',
anchor:'100% 80%',
columns: [
{header: 'Property Description', dataIndex: 'Property Description',flex:1,
editor: {
xtype: 'combo'}
},
{header: 'Gain($)', dataIndex: 'Gain',flex:1,
editor: {
xtype: 'textfield'}
},
{header: 'Loss ($)', dataIndex: 'Loss',
editor: {
xtype: 'textfield'
},flex:1
}
],
plugins: [
Ext.create('Ext.grid.plugin.RowEditing', {
clicksToEdit: 1
})
]
});






var targetElement = Ext.getCmp('gLSGrid');
var myWindow = window.open('');
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();

scottmartin
6 Oct 2012, 9:35 AM
Please have a look at the following:
http://www.sencha.com/forum/showthread.php?146348

Scott.