jQWidgets Forums

jQuery UI Widgets Forums TreeGrid Print Button

This topic contains 9 replies, has 3 voices, and was last updated by  Peter Stoev 9 years, 10 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Print Button Posts
  • Print Button #55204

    erikt_ctg
    Participant

    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?

    Print Button #55206

    Peter Stoev
    Keymaster

    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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Print Button #55595

    erikt_ctg
    Participant

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

    Print Button #55597

    Peter Stoev
    Keymaster

    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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Print Button #70054

    AneVisser
    Participant

    I have had the same problem. When I added:

    exportSettings: {fileName: null}

    in the definition of the treegrid, it all worked fine

    Print Button #70058

    Peter Stoev
    Keymaster

    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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Print Button #72563

    AneVisser
    Participant

    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?

    Print Button #72567

    Peter Stoev
    Keymaster

    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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Print Button #72656

    AneVisser
    Participant

    Could you please give me an example of a correctly written filename? Does it include an extension or something like that?

    Print Button #72659

    Peter Stoev
    Keymaster

    Hi AneVisser,

    Your parameter is not correct – it should be fileName, not filename. Ex: http://jsfiddle.net/bzzmts3q/

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.