Announcement

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

    Calendar Weekview not refreshing properly

    When I do calendar.setData while the day or month view is open, both the day and month view are up to date when I switch to them. If I switch to the week view none of the data has been updated and it remains that way until calendar.setData is called while the week view is open.

    If I call calendar.setData while the week view is open all 3 view get updated properly.

    #2
    Please show a standalone, minimal test case for this.

    Comment


      #3
      Code:
      import com.google.gwt.core.client.EntryPoint;
      import com.google.gwt.user.client.Timer; 
      import com.smartgwt.client.widgets.calendar.*;
      import com.google.gwt.user.client.ui.RootPanel;
      import java.util.Date;
      
      public class ViewTechCalendar implements EntryPoint {
      	
      	Calendar calendar = null;
      	Date date = null;
      	
      	public void onModuleLoad()
      	{
      		calendar = new Calendar();
      		calendar.setTitle("Calendar");
      		calendar.setChosenDate(new Date());
      		calendar.setCanEditEvents(false);
      		calendar.setWidth(1000);
      		calendar.setHeight(700);
      		date = new Date();
      		RootPanel.get("calendarDiv").add(calendar);
      		Timer elapsedTimer = new Timer () {
      			public void run() {
      				addData();
      	        }
      	    };
      	    elapsedTimer.scheduleRepeating(30000);
      	    addData();
      	}
      
      	public void addData()
      	{
      		CalendarEvent event = new CalendarEvent();
      		event.setStartDate(date);
      		date = new Date(date.getTime() + 3600000);
      		event.setEndDate(date);
      		CalendarEvent[] oldData = calendar.getData();
      		CalendarEvent[] newData = new CalendarEvent[oldData.length + 1];
      		for(int x = 0; x < oldData.length; x++)
      			newData[x] = oldData[x];
      		newData[oldData.length] = event;
      		calendar.setData(newData);
      	}
      }
      If you leave open the day or month view both of them refresh properly every 30 seconds when a new event is added. But when you switch to week view only what was there last time you looked at week view is there. Once a new event is added while week view is open they all appear.

      Also I'm getting a weird new bug with week view that I never got in my real code. All the events are showing up on the correct day in day and month view, but are shifted 1 day into the future in the week view. It may have something to do with the time having seconds and milliseconds in it since my real code only has times in increments of 15 minutes and seconds and miliseconds are always 0. But its still another odd thing about week view not working the same as the other 2 views.

      Comment

      Working...
      X