Announcement

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

    DateChooser marking holidays and other special days

    Hi,

    I'am using SmartGWT 4.1-p20140410 on Firefox 26.0. I am trying to mark some "special days" on date picker (holidays, etc.). My code looks like this:

    Code:
    public class DateItem extends com.smartgwt.client.widgets.form.fields.DateItem {
    
    	private DateChooser chooser = new DateChooser();
    
    	public DateItem(String name, String title) {
    		super(name, title);
    		onInit();
    	}
    
    	private void onInit() {
    Date[] dates = new Date[]{new Date(2014, 06, 26)};
    chooser.setDisabledDates(dates); 
    chooser.setDisabledWeekdayStyle("holidays");
    chooser.setDisabledWeekendStyle("holidays");
    	}
    }
    I am trying to set disabled dates and add them new css style

    Code:
    .holidays {
    	color: red;
    }
    but it takes no effect. Any ideas how to mark "special days" on date chooser?
    Last edited by majster; 27 Jun 2014, 01:43. Reason: Accidentally posted.

    #2
    A DateItem's picker is automatically created - use dateItem.setPickerProperties() or setAutoChildProperties() to pass a DateChooser with your disabledDates set on it.

    Comment


      #3
      Did what you said, but it looks like on screen. In my opinion 26/06/2014 should be red too.

      Code:
      		Date[] dates = new Date[]{new Date(2014, 6, 26)};
      		chooser.setDisabledDates(dates);
      		chooser.setDisabledWeekdayStyle("holidays");
      		chooser.setDisabledWeekendStyle("holidays");
      		setPickerProperties(chooser);
      Am I wrong? But my purpose was only to have 26/06/2014 in other style ("holidays"), days from other months should be still in old style.
      Attached Files

      Comment


        #4
        The date you're disabling is in July, not June. Change to July and you should see it styled as you expect.
        Last edited by Isomorphic; 27 Jun 2014, 05:53.

        Comment


          #5
          No worries majster,

          I'd have made the same mistake. Did not see that one either. DateTime for JSR-310 support in GWT :)

          Best regards,
          Blama

          Comment


            #6
            Ok, I've done thanks Blama. But how make days from other month not to be styled like that? (I mean they should not have same style as day 26, only day 26 should be awarded)
            Attached Files
            Last edited by majster; 27 Jun 2014, 06:39.

            Comment


              #7
              It's not currently possible with public APIs to do what you're trying to do. Days in other months and those on weekends, if disableWeekends is true, are considered disabled, as well as those you specify in disabledDates.

              All disabled dates currently use the same styles - the ones you're setting in your sample.

              Comment


                #8
                Any clue how to resolve it?

                Comment


                  #9
                  You might get something close with custom CellStyle handlers on the DateGrid AutoChild of the DateChooser - or we could add the facility as a feature sponsorship
                  (http://www.smartclient.com/services/index.jsp#features)

                  Comment

                  Working...
                  X