Results 1 to 3 of 3

Thread: problem with printing widget

  1. #1
    Sencha User
    Join Date
    Nov 2012

    Default problem with printing widget

    i have searched online for printing gxt widget like grid or window and work fine with eclipse debug moded. but when it run in tomcat ,i do not work and print nothing.this is my code;
    public class Print {
        public static native void it() /*-{                                                                                                            
        public static native void doit(String html) /*-{                                                                                               
            var frame = $doc.getElementById('__printingFrame');                                                                                        
            if (!frame) {                                                                                                                              
                $wnd.alert("Error: Can't find printing frame.");                                                                                       
            frame = frame.contentWindow;                                                                                                               
            var doc = frame.document;                                                                                                                  
        public static void it(String html) {
            try { 
            } catch (Throwable exc) {
        public static void it(UIObject obj) {
            it("", obj.getElement().toString());
        public static void it(Element element) {
            it("", element.toString());
        public static void it(String style, String it) {
        public static void it(String style, UIObject obj) {
            it(style, obj.getElement().toString());
        public static void it(String style, Element element) {
            it(style, element.toString());
    then to use it
    Code:"<link type='text/css' rel='stylesheet' href='WebCheckGXT.css'>", view);
    view is a gxt grid. thanks for your reply!

  2. #2
    Ext GWT Premium Member
    Join Date
    Sep 2011
    Superior, CO


    We've run into this issue as well. I think the problem has to do with the brower's treatment of the way images are handled in GXT. IIRC, the images are rendered as background images and I think browsers don't print them. (Checkboxes in a selection grid also don't print).

    Our solution was to create our tabular data in a separate window not using GXT and then execute a print.

  3. #3
    Sencha User
    Join Date
    Feb 2009


    This could also be related to the fact that you are picking up the html of the grid, but none of its styling, which is done via CSS on the html page.

    Please note that Element.toString() might not print anything useful:
       * Makes a best-effort attempt to get a useful debugging string describing the
       * given JavaScriptObject. In Production Mode with assertions disabled, this
       * will either call and return the JSO's toString() if one exists, or just
       * return "[JavaScriptObject]". In Development Mode, or with assertions
       * enabled, some stronger effort is made to represent other types of JSOs,
       * including inspecting for document nodes' outerHTML and innerHTML, etc.
      public final String toString() {
        return JavaScriptObject.class.desiredAssertionStatus() ?
            toStringVerbose(this) : toStringSimple(this);
    Instead, consider something like getOuterHTML(), or processing the data differently to make sure you get what you are after (like a template).

    Have you tried making that iframe visible and seeing what is displayed *without* printing? If that displays content, have you tried printing with the iframe visible instead of hidden?

    Printing a grid isn't always a great idea without some specific changes made, since the grid draws headers at the top and scrollbars - that doesn't look great on the printed page, which should probably get headers repeated each page and should flow instead of only printing what is visible on the user's screen. We usually suggest (like icfantv said) to render the content in a specific way that looks good on a printed page - black and white, or at least higher contrast than blue/black, and no scrollbars.

    Can you share a full example that doesn't work, including the Grid itself and the contents of the WebCheckGXT.css file? It is possible that there is something in your grid itself that is preventing this, but we'll never see it without being able to verify that code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts