Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha Premium Member
    Join Date
    Apr 2013
    Location
    Oregon
    Posts
    2
    Vote Rating
    0
    jmorris is on a distinguished road

      0  

    Default GXT 3.0.X DatePicker not propertly displaying min / max range when month is changed

    GXT 3.0.X DatePicker not propertly displaying min / max range when month is changed


    When setting a min or max date on the DatePicker the date range is initially shown correctly with the disabled date cells. Changing months back and forth leaves everything disabled however.

    Code:
        public void onModuleLoad ()
        {
            Date today = new Date();
    
            Date min = new Date();
            min.setDate(today.getDate() - 1);
    
            Date max = new Date();
            max.setDate(today.getDate() + 1);
    
            DatePicker dp = new DatePicker();
            dp.setMinDate(min);
            dp.setMaxDate(max);
            dp.setValue(today);
    
    
            RootPanel.get().add(dp);
        }

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,717
    Vote Rating
    88
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    3.0.x is slightly vague - that leaves 6 possible options for versions, or are you saying it is broken in all 3.0.0-3.0.4?

  3. #3
    Sencha Premium Member
    Join Date
    Apr 2013
    Location
    Oregon
    Posts
    2
    Vote Rating
    0
    jmorris is on a distinguished road

      0  

    Default


    Version 3.0.1 had the issue but it seems to have been fixed with version 3.0.4.

  4. #4
    Sencha User
    Join Date
    Jun 2013
    Posts
    7
    Vote Rating
    0
    bawan is on a distinguished road

      0  

    Default


    it can be fixed by changing this function in the DatePicker

    Code:
    private void setCellStyle(Element cell, Date d, long sel, long min, long max) {
            long t = d.getTime();
    
            DateWrapper w = new DateWrapper(d);
            int year = w.getFullYear();
            int month = w.getMonth();
            int day = w.getDate();
    
            String dd = year + "," + month + "," + day;
    
            cell.getFirstChildElement().setPropertyString("dateValue", dd);
    
            appearance.onUpdateDateStyle(cell, DateState.TODAY, t == today);
            appearance.onUpdateDateStyle(cell, DateState.SELECTED, t == sel);
    
            if (t > max || t < min) {
                appearance.onUpdateDateStyle(cell, DateState.DISABLED, true);
                if (t > max) {
                    cell.setTitle(messages.maxText());
                } else {
                    cell.setTitle(messages.minText());
                }
            } else {
                appearance.onUpdateDateStyle(cell, DateState.DISABLED, false);
                cell.setTitle("");
            }
        }

Thread Participants: 2

Tags for this Thread