Announcement

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

    Printing Calendar Day and Week View doesn't work

    Using the calendar sample I added a button to show a print preview of the calendar. When the button is pressed I get an empty raster of the day or week view (month view works!), without any of the events:
    Code:
    /*
     * Smart GWT (GWT for SmartClient)
     * Copyright 2008 and beyond, Isomorphic Software, Inc.
     *
     * Smart GWT is free software; you can redistribute it and/or modify it
     * under the terms of the GNU Lesser General Public License version 3
     * as published by the Free Software Foundation.  Smart GWT is also
     * available under typical commercial license terms - see
     * http://smartclient.com/license
     *
     * This software is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
     * Lesser General Public License for more details.
     */
    package smartgwtcalendar.client;
    
    import com.google.gwt.core.client.EntryPoint;
    
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.data.fields.DataSourceDateTimeField;
    import com.smartgwt.client.data.fields.DataSourceSequenceField;
    import com.smartgwt.client.data.fields.DataSourceTextField;
    import com.smartgwt.client.widgets.Canvas;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.calendar.Calendar;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class SmartGWTCalendar implements EntryPoint {
        @Override
        public void onModuleLoad() {
            DataSource eventDS = new DataSource();
            DataSourceSequenceField eventIdField = new DataSourceSequenceField("eventId");
            eventIdField.setPrimaryKey(true);
    
            DataSourceTextField nameField = new DataSourceTextField("name");
            DataSourceTextField descField = new DataSourceTextField("description");
            DataSourceDateTimeField startDateField = new DataSourceDateTimeField("startDate");
            DataSourceDateTimeField endDateField = new DataSourceDateTimeField("endDate");
    
            eventDS.setFields(eventIdField, nameField, descField, startDateField, endDateField);
            eventDS.setClientOnly(true);
            eventDS.setTestData(CalendarData.getRecords());
    
            final Calendar calendar = new Calendar();
            calendar.setDataSource(eventDS);
            calendar.setAutoFetchData(true);
            calendar.setCanDragEvents(false);
            calendar.setCanDragResize(false);
    
            IButton printButton = new IButton("Print");
            printButton.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    Canvas.showPrintPreview(calendar);
                }
            });
    
            VLayout layout = new VLayout();
            layout.setSize("100%", "100%");
            layout.addMember(printButton);
            layout.addMember(calendar);
            layout.draw();
        }
    }
    I'm using GWT 2.3 and SmartGWT 2.5

    #2
    Please try this against the latest nightly of 2.5.x from SmartClient.com/builds. If you're still having a problem, please fill in the rest of the required information (browser(s) tested, etc).

    Comment


      #3
      the nightly (SmartGWT LGPL Edition 2011-11-07) doesn't make any difference. I tried it with
      + FF 7.0.1
      + IE 9.0.8.8112
      + Chrome 17.0.928.0 dev-m
      + Safari 5.1.1
      + Opera 11.52 (CalendarWidget doesn't work there at all, I my test program only shows the Print button!)

      I tried it in Dev Mode an deployed mode.

      I'm using Netbeans 7.0.1 on Windows 7 x64

      Comment

      Working...
      X