Announcement

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

  • Problem with changed event in MiniDateRangeItem

    Hi guys,

    We are using the MinidDateRangeItem several places in our application, but are having some problems with changing the dates and getting changed events. This can be reproduced in the Showcase as well. Consider the following code:
    Code:
    public class App implements EntryPoint {
       private Layout panel;
    
       public void onModuleLoad() {
          MiniDateRangeItem dateItem = new MiniDateRangeItem("dateRangeItem");
            dateItem.setWidth("*");
            dateItem.addChangedHandler(changedEvent -> {
                GWT.log("Changed!");
                DateRange dr = (DateRange) changedEvent.getValue();
                Label l = new Label("Start=" + dr.getStartDate() + " End=" + dr.getEndDate());
                l.setWidth100();
                l.setHeight(30);
                l.setWrap(false);
                panel.addMember(l);
            });
    
            DynamicForm form = new DynamicForm();
            form.setNumCols(3);
            form.setColWidths(100, 300, "*");
            form.setWidth100();
            form.setItems(dateItem);
    
            panel = new VLayout();
            panel.setWidth100();
            panel.setHeight100();
            panel.setMembers(form);
            panel.draw();
       }
    }

    Steps to reproduce problem:
    1. Click on the MiniDateRangeItem and set start and end date. Clicking OK fires a changed event.
    2. Click on the MiniDateRangeItem and set a new end date by clicking the date chooser icon and select a new date.
    3. End dates changes to newly selected date, but clicking OK does not fire a changed event.
    4. The shown value in the MiniDateRangeItem is correct
    5. Click on the MiniDateRangeItem. The value of the end date is now the originally selected date.
    6. Changing the end date manually and click OK does not fire change event either.
    7. But value of MiniDateRangeItem shows the correctly selected start and end dates.
    We also noticed that the first time we select start and end dates (when the fields are empty), we can press a Apply button to set the dates. The apply button is not shown, when changing the dates the subsequent times.

    We are using GWT 2.8.2, SmartGWT LGPL 20190311 on Chrome 72.0.3626 on Mac OS X 10.14.3.
    Are we using the MiniDateRangeItem in wrong way?

    Click image for larger version

Name:	Screenshot 2019-03-12 at 13.29.11.png
Views:	1
Size:	29.3 KB
ID:	257136

    Best Regards
    Rasmus
    Attached Files

  • #2
    The issue where the change events don't fire once the item has a value has been fixed for builds dated March 15 and later.

    The issue with the Apply button that you mention is probably due to internal code to decide whether the value in question is a date or a datetime, and so whether a time item and Apply button need to be displayed.

    We'll take a look to see if there's a problem there, but you can fix it right away by just specifying a type on your field - either "date" or "datetime".

    Comment


    • #3
      20190315 fixed the problem and setting the "type" field is also working fine.
      Thanks :)

      Best Regards
      Rasmus

      Comment

      Working...
      X