<div id="bottomPane" data-dojo-type="dijit.layout.ContentPane" region="bottom" style="width:auto, position:absolute; top:auto"> <div dojoType="dojox.layout.Dock" id="dock" widgetid="dock"></div> <h3 id="gridTitle">Providers in this area: </h3> Click Provider Map to see these locations. <button id="btnPrint" dojotype="dijit.form.Button" onClick="printIt(document.getElementById('resultsGrid').innerHTML); return false;" title="Print List" value="Print List">Print List</button> <table data-dojo-type="dojox.grid.DataGrid" id="resultsGrid" selectionmode="none" > <thead> <tr> <th field="PIN" formatter="makeZoomButton" width="35px" title="First, open map,click on ID to see location."> </th> <th field="FACILITY" width="400px">Provider</th> <th field="ADDRESS" width="320px">Address</th> <th field="CITY" width="190px">City</th> <th field="PHONE" width="150px">Phone</th> </tr> </thead> </table> </div>
function printIt(printThis) { var win = window.open(); self.focus(); win.document.open(); win.document.write('<'+'html'+'><'+'head'+'><'+'style'+'>'); win.document.write('body, td { font-family: Verdana; font-size: 12pt;}'); win.document.write('<'+'/'+'style'+'><'+'/'+'head'+'><'+'body'+'>'); win.document.write(printThis); win.document.write('<'+'/'+'body'+'><'+'/'+'html'+'>'); win.document.close(); win.print(); win.close(); }
Solved! Go to Solution.
function printIt() { var win = window.open(); self.focus(); win.document.open(); win.document.write('<'+'html'+'><'+'head'+'><'+'style'+'>'); win.document.write('body, td { font-family: Verdana; font-size: 12pt;}'); win.document.write(' th { font-weight: bold; text-align:left;}'); win.document.write('<'+'/'+'style'+'><'+'/'+'head'+'><'+'body'+'>'); win.document.write('<table style=\"width:100%\"><th >Facility</th><th >Address</th><th >City</th><th >Phone</th>'); store.fetch({ onComplete: function (items) { dojo.forEach(items, function (item, index) { win.document.write('<tr><td>' + item.FACILITY + '</td><td>' + item.ADDRESS + '</td><td>' + item.CITY + '</td><td>' + item.PHONE + '</td></tr>'); }); } }); win.document.write('</table>'); win.document.write('<'+'/'+'body'+'><'+'/'+'html'+'>'); win.document.close(); win.print(); win.close(); }
function printIt(myGrid) { var win = window.open(); self.focus(); win.document.open(); win.document.write('<'+'html'+'><'+'head'+'><'+'style'+'>'); win.document.write('body, td { font-family: Verdana; font-size: 12pt;}'); win.document.write('<'+'/'+'style'+'><'+'/'+'head'+'><'+'body'+'>'); win.document.write('<table style=\"width:100%\"><th style=\"font-weight:bold\">Facility</th><th style=\"font-weight:bold\">Address</th><th style=\"font-weight:bold\">City</th><th style=\"font-weight:bold\">Phone</th>'); myGrid.store.fetch({ onComplete: function (items) { dojo.forEach(items, function (item, index) { ... win.document.write('<tr><td>' + item.FACILITY + '</td><td>' + item.ADDRESS + '</td><td>' + item.CITY + '</td><td>' + item.PHONE + '</td></tr>'); }) } }); win.document.write('</table>'); win.document.write('<'+'/'+'body'+'><'+'/'+'html'+'>'); win.document.close(); win.print(); win.close(); }
function printIt() { var win = window.open(); self.focus(); win.document.open(); win.document.write('<'+'html'+'><'+'head'+'><'+'style'+'>'); win.document.write('body, td { font-family: Verdana; font-size: 12pt;}'); win.document.write('<'+'/'+'style'+'><'+'/'+'head'+'><'+'body'+'>'); win.document.write('<table style=\"width:100%\"><th style=\"font-weight:bold\">Facility</th><th style=\"font-weight:bold\">Address</th><th style=\"font-weight:bold\">City</th><th style=\"font-weight:bold\">Phone</th>'); store.fetch({ onComplete: function (items) { dojo.forEach(items, function (item, index) { win.document.write('<tr><td>' + item.FACILITY + '</td><td>' + item.ADDRESS + '</td><td>' + item.CITY + '</td><td>' + item.PHONE + '</td></tr>'); }); } }); win.document.write('</table>'); win.document.write('<'+'/'+'body'+'><'+'/'+'html'+'>'); win.document.close(); win.print(); win.close(); }
text-align: <left|center|right>
vertical-align: <top|center|bottom>
function printIt() { var win = window.open(); self.focus(); win.document.open(); win.document.write('<'+'html'+'><'+'head'+'><'+'style'+'>'); win.document.write('body, td { font-family: Verdana; font-size: 12pt;}'); win.document.write(' th { font-weight: bold; text-align:left;}'); win.document.write('<'+'/'+'style'+'><'+'/'+'head'+'><'+'body'+'>'); win.document.write('<table style=\"width:100%\"><th >Facility</th><th >Address</th><th >City</th><th >Phone</th>'); store.fetch({ onComplete: function (items) { dojo.forEach(items, function (item, index) { win.document.write('<tr><td>' + item.FACILITY + '</td><td>' + item.ADDRESS + '</td><td>' + item.CITY + '</td><td>' + item.PHONE + '</td></tr>'); }); } }); win.document.write('</table>'); win.document.write('<'+'/'+'body'+'><'+'/'+'html'+'>'); win.document.close(); win.print(); win.close(); }