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

    Hiding DateChooser TimeItem from MiniDateRangeItem

    SmartGWT version 4.1d July 01 2013

    We experienced an issue with the DateChooser widget recently when we upgraded to SmartGWT 4.1d. We for the first time saw that the DateChooser widget exposed Hour + Minute drop down lists.

    We saw that the DateChooser didn't always show the Hour + Min drop downs in our app and found out that the difference was that we had some fields defined as Date and some fields defined as DateTime.

    The problem we are experiencing is as follows:

    1) The DateChooser is not showing the Hour + Min drop downs properly. The drop downs themselves are too narrow and the Hour + Min text in them are being shown as ... text only. If I use FireBug or something like that and expand the width of the widget (from 11px to 15px or so) then the widget displays the text properly. I was wondering if the load_skin.js file had some new attributes or flags exposed, but was not able to see something stand out...

    2) Because of the first issue, I'm trying to hide the DateChooser's TimeItem widget (for now at least since we have never needed this time item before) by calling the DateChooser.setShowTimeItem(Boolean.FALSE); method. We do not need allow the end user to choose Hour + Min currently.

    The problem is, I do not have an instance of a DateChooser when I'm defining my ListGrid date time fields... I have a MiniDateRangeItem instance (as shown in the code snippet below).

    So I'm wondering if there is a way to do something like this in the SmartGWT api?

    MiniDateRangeItem miniDateRangeItem = new MiniDateRangeItem();
    // tell MiniDateRangeItem that the DateChooser it will show should not show TimeItem:
    ListGridField dateTimeField = new ListGridField("DateTime", 100);
    Attached Files
    Last edited by jornn; 22 Jul 2013, 14:29.

    I would like to get an answer on the same problem. How can I hide the Time Pickers from the MiniDateRangeItem.
    final MiniDateRangeItem dateRangeItem = new MiniDateRangeItem();
    dateRangeItem.setDateDisplayFormat( DateDisplayFormat.TOUSSHORTDATE );
    field.setFilterEditorProperties( dateRangeItem );
    Last edited by aafros; 9 Sep 2015, 06:19.


      What is the type of the Field you're assigning this MDRI to? If there's no type, assign "date", and that should result in the time-pickers being hidden.

      If the field is already type: "date", then time-pickers being visible would be a bug that we could look into, given databinding details.

      Otherwise, if it's really a datetime field but you just don't want users to pick times, you can use the autoChild system to setShowPickerTimeItem(false) on the "fromField" and "toField" autoChildren - it's fiddly, but you can do this via item.rangeDialog.rangeItem.


        The type of the field is "datetime", but I still wanted to hide the time from the Date Picker without changing the type to the "date". I will try to use the setShowPickerTimeItem(false) .