Announcement

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

    MiniDateRangeItem Calendar has problem with Time. Click/Doulbe Click does not work.

    Used version is: v10.1p_2016-06-16/PowerEdition Deployment (built 2016-06-16)
    The bug is reproduced on both Microsoft Edge and Fire Fox 24.8.1.
    The click on the Date of the Calendar just selects the date. Click on Today button just selects the today dates.
    In all previous versions - these clicks closed the calendar and entered the date on the select.
    1. Create the DataSource :
    Code:
    import com.smartgwt.client.data.DataSource;  
    import com.smartgwt.client.data.fields.DataSourceBooleanField;  
    import com.smartgwt.client.data.fields.DataSourceDateTimeField;
    import com.smartgwt.client.data.fields.DataSourceFloatField;  
    import com.smartgwt.client.data.fields.DataSourceIntegerField;  
    import com.smartgwt.client.data.fields.DataSourceTextField;  
      
    public class WorldXmlDS extends DataSource {  
      
        private static WorldXmlDS instance = null;  
      
        public static WorldXmlDS getInstance() {  
            if (instance == null) {  
                instance = new WorldXmlDS("worldDS");  
            }  
            return instance;  
        }  
      
        public WorldXmlDS(String id) {  
      
            setID(id);  
            setRecordXPath("/List/country");  
            DataSourceIntegerField pkField = new DataSourceIntegerField("pk");  
            pkField.setHidden(true);  
            pkField.setPrimaryKey(true);  
      
            DataSourceTextField countryCodeField = new DataSourceTextField("countryCode", "Code");  
            countryCodeField.setRequired(true);  
      
            DataSourceTextField countryNameField = new DataSourceTextField("countryName", "Country");  
            countryNameField.setRequired(true);  
      
            DataSourceTextField capitalField = new DataSourceTextField("capital", "Capital");  
            DataSourceTextField governmentField = new DataSourceTextField("government", "Government", 500);  
      
            DataSourceBooleanField memberG8Field = new DataSourceBooleanField("member_g8", "G8");  
      
           DataSourceTextField continentField = new DataSourceTextField("continent", "Continent");
            continentField.setValueMap("Europe", "Asia", "North America", "Australia/Oceania", "South America", "Africa");  
      
            [B]DataSourceDateTimeField independenceField = new DataSourceDateTimeField("independence", "Nationhood");  [/B]
            DataSourceFloatField areaField = new DataSourceFloatField("area", "Area (kmē)");  
            DataSourceIntegerField populationField = new DataSourceIntegerField("population", "Population");  
            DataSourceFloatField gdpField = new DataSourceFloatField("gdp", "GDP ($M)");  
              
            setFields(pkField, countryCodeField, countryNameField, capitalField, governmentField,  
                    memberG8Field, continentField, independenceField, areaField, populationField,  
                    gdpField);  
      
            //setDataURL("ds/test_data/world.data.xml");  
            setClientOnly(true);  
        }  
    }
    Create the outlook:
    Code:
                     WorldXmlDS ds = WorldXmlDS.getInstance();
                     final ListGrid grid2 = new ListGrid();  
                     grid2.setWidth("100%");  
                     grid2.setDataSource(ds);  
                     grid2.setShowFilterEditor(true);
                    
                    
                   [B]  final MiniDateRangeItem dateRangeItem = new MiniDateRangeItem()[/B];
                     dateRangeItem.setDateDisplayFormat( DateDisplayFormat.TOUSSHORTDATE);
                    
                     ListGridField dateField = new ListGridField("independence", "My Date Title");
                    [B] dateField.setFilterEditorProperties(dateRangeItem);[/B]
    
                     grid2.setFields(dateField);
                    
                            
                     VLayout layout = new VLayout(8);  
                     layout.setHeight100();  
                     layout.setWidth100();  
                     layout.setMembersMargin(10);
                     layout.setMembers(grid2);
    
            //just display the grid2 any where for example:
    // RootPanel.get("formContainer").add(layout);
    The outlook is attached.
    1. Click on the Calendar on the list grid.
    2. Select Date Range Dialog is opened
    3. Click on any From or To Calendar.
    The opened calendar does not work as previous versions.
    Click/Double Click on the date does not close the Calendar, but just select the date.
    Click on the today button does not close the calendar, but just select today.
    User should click Apply to close the Calendar.
    Please make the Calendar work as it did in previous versions.
    Attached Files
    Last edited by aafros; 30 Jun 2016, 13:09.

    #2
    The behavior you're after is true for fields of type "date", where there's no relevent time portion to the value being selected.

    When a field is of type "datetime", a separate time-editor is displayed and, in that case, default behavior is to *not* auto-dismiss when a date is clicked, because that would likely result in users not noticing that a time-value is also relevent.

    If you don't want the Time-editor, you can hide it either by making your field a "date" field, or by setting DateChooser.showTimeItem to false.

    If you need the time-editor to show, but you still want to auto-dismiss when a date is clicked, see DateChooser.setCloseOnDateClick(), which you can set globally via DateChooser.setDefaultProperties().

    Comment


      #3
      Thanks for explanation. I see that the behavior has been changed in the 5.1. and I see the reason for it. I just fought it should be documented somehow.
      Last edited by aafros; 4 Jul 2016, 05:48.

      Comment

      Working...
      X