jQWidgets Forums
jQuery UI Widgets › Forums › TreeGrid › Print Button
Tagged: treegrid printing
This topic contains 9 replies, has 3 voices, and was last updated by Peter Stoev 9 years, 10 months ago.
-
AuthorPrint Button Posts
-
I am having a tough time trying to integrate the print code into PLSQL. A new window opens and the window screen prints “undefined”. The print dialog box pops up but when printing it just prints undefined. However, I do receive an option to save a download from Internet Explorer that opens the correct windows and data. I just want to be able to print from the pop up window form the print dialog box. Any suggestions?
Hi erikt_ctg,
If your new window prints undefined, that means that most probably your “gridContent” variable is undefined. My suggestion is to check whether it is defined or whether you haven’t missed some JavaScript reference or additional code snippets. Example for printing – http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxtreegrid/javascript-tree-grid-printing.htm?arctic
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Here is what I am using. I have been switching things up to make it work but I keep getting undefined. Am I just missing something here?
$(“#print”).jqxButton({ width: 80, theme: “energyblue” });
$(“#print”).click(function () {
var gridContent = $(“#treeGrid”).jqxTreeGrid(“exportData”, “html”);
var newWindow = window.open(“”, “”, “width=800, height=500”),
document = newWindow.document.open(),
pageContent = “<!DOCTYPE html>” +
“<html>” + “<head>” +
“<meta charset=”utf-8” />” +
“<title>IPTask Tracker</title>” +
“<body>” + gridContent + “</body>”+”</head>”+”</html>”;document.write(pageContent);
document.close();
newWindow.print();Hi erikt_ctg,
Please, provide a full sample(preferably in jsfiddle.net), so we would be able to test your code. In addition, my suggestion is to look again for differences between our working sample and your code. It is possible that you missed a required JavaScript reference such as “jqxdata.export.js” or something like that.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/I have had the same problem. When I added:
exportSettings: {fileName: null}
in the definition of the treegrid, it all worked fine
Hi Ane,
That is because if you don’t set the fileName to null, the widget will Export data to a File instead of Variable. Exporting to File is the Default behavior.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/However, when I set the export settings to a real string value, the treegrid is exported with the default file name:
exportSettings: { filename: ‘January’ }
exports the file to: jqxTreeGrid_Data.xls, and not to January.xls
Is this supposed to work this way?
Hi Ane,
When the parameter is written correctly, it will export it with the new file name, but as far as I see filename is written incorrectly.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Could you please give me an example of a correctly written filename? Does it include an extension or something like that?
Hi AneVisser,
Your parameter is not correct – it should be fileName, not filename. Ex: http://jsfiddle.net/bzzmts3q/
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.