Announcement

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

    DateChooser can't change selected day (without Calendar)

    I try to use a DateChooser, but the visual selected day is not modified.

    The data is good, i obtain good day with : dateChooser.getData();
    But the new selected day is not refresh.

    Code:
      		final DateChooser dateChooser = new DateChooser();
    		dateChooser.setWidth(200);
    		dateChooser.setHeight(200);
    
    		dateChooser.addDataChangedHandler(new DataChangedHandler(){
    
    			public void onDataChanged(DataChangedEvent event) {
    				
    				System.out.println("dateRef (old):"+dateRef);
    				
    				dateRef = dateChooser.getData();
    				
    				System.out.println("dateRef (new):"+dateRef);
    
    
    			}				
    			
    		});
    dateRef (old):null
    dateRef (new):Fri Feb 06 00:00:00 CET 2009

    dateRef (old):Fri Feb 06 00:00:00 CET 2009
    dateRef (new):Sat Feb 07 00:00:00 CET 2009

    Here is a bug ? or i have missing a method ?

    #2
    DateChooser assumes it's going to be dismissed by the selection - you should be able to set the date and call redraw it.

    Comment


      #3
      It's doesn't work :

      Select date by click half work :
      * dateChooser.getData(); return correct selected date
      * but the visual selected day isn't refresh (same with a dateC.redraw();)

      Set the the date doesn't work :
      * after a setter "setData(dateForceOtherDay)", the get return old date

      Code:
      		DateChooser dateChooser = new DateChooser();
      		dateChooser.setID("MyDateChooser");
      		dateChooser.setWidth(200);
      		dateChooser.setHeight(200);
      
      		Date dateForceOtherDay = new Date();
      		dateForceOtherDay.setDate(8);
      		dateChooser.setData(dateForceOtherDay);
      		
      		System.out.println("dateOfDateChooser (old):"+dateChooser.getData());
      		
      		dateChooser.addDataChangedHandler(new DataChangedHandler(){
      
      			public void onDataChanged(DataChangedEvent event) {
      				
      				DateChooser dateC = (DateChooser) WidgetCanvas.getById("MyDateChooser");
      				System.out.println("dateOfDateChooser (new):"+dateC.getData());
      
      				Date dateForceOtherDay = new Date();
      				dateForceOtherDay.setDate(1);
      
      				System.out.println("date force : "+dateForceOtherDay);
      				dateC.setData(dateForceOtherDay);
      				
      				System.out.println("dateOfDateChooser (new force):"+dateC.getData());
      				dateC.redraw();
      			}				
      			
      		});
      		RootPanel.get().add(dateChooser);
      Where a the Feb 05, i click on Feb 26, at en end it's always the Feb 05 who are visual selected and the Feb 26 in the data instead of force date by setter : Feb 01

      dateOfDateChooser (old):Thu Feb 05 11:16:43 CET 2009
      dateOfDateChooser (new):Thu Feb 26 00:00:00 CET 2009
      date force : Sun Feb 01 11:16:47 CET 2009
      dateOfDateChooser (new force):Thu Feb 26 00:00:00 CET 2009

      I think, is a bug. Tested with last source code from SVN.
      Last edited by immobilia; 5 Feb 2009, 02:30.

      Comment

      Working...
      X