Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Print preview shows grid twice

    Using print preview, list grid is duplicated:Click image for larger version

Name:	2-5-2016 12-28-47 PM.png
Views:	55
Size:	10.7 KB
ID:	234689

    SmartClient Version: v10.1p_2016-01-14/Enterprise Deployment (built 2016-01-14)

    Latest Chrome (48.0.2564.103 m)

    problem is reproducible on client without server side

    minimum working example/standalone test case:
    Code:
    package example.client.printpreviewdoublegrid;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.data.Record;
    import com.smartgwt.client.types.ListGridFieldType;
    import com.smartgwt.client.widgets.Canvas;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    /**
     * Entry point classes define {@code onModuleLoad() }.
     */
    public class PrintPreviewDoubleGrid implements EntryPoint
    {
        public void onModuleLoad()
        {
            final ListGrid grid = new ListGrid();
            grid.setWidth(500);
            grid.setHeight(200);
    
            // ------ build fields ----------------------
            ListGridField[] fields = new ListGridField[2];
    
            fields[0] = new ListGridField("name");
            fields[0].setType(ListGridFieldType.TEXT);
    
            fields[1] = new ListGridField("value");
            fields[1].setType(ListGridFieldType.FLOAT);
    
            grid.setFields(fields);
    
            // ------ build data ------------------------
            Record[] data = new Record[3];
            data[0] = record("Alice", 100);
            data[1] = record("Bob", 200);
            data[2] = record("Cheryl", 300);
    
            grid.setData(data);
    
            // ----------- print button ---------------------
    
            IButton button = new IButton();
            button.setAutoFit(true);
            button.setTitle("Print");
            button.addClickHandler(new ClickHandler()
            {
                public void onClick(ClickEvent event)
                {
                    Canvas.showPrintPreview(grid);
                }
            });
    
            // ----------- put components together and render ---------------------
    
            VLayout vlayout = new VLayout();
            vlayout.addMember(grid);
            vlayout.addMember(button);
    
            vlayout.draw();
        }
    
        private Record record(String name, double value)
        {
            Record record = new Record();
            record.setAttribute("name", name);
            record.setAttribute("value", value);
            return record;
        }
    }

    #2
    We have recently made a change to address exactly this issue. Please try the latest nightly build (available from smartclient.com/builds) and let us know if the problem persists.

    Regards
    Isomorphic Software

    Comment


      #3
      Just tested and the issue is resolved.

      Thank you.

      Comment

      Working...
      X