Announcement

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

    default value for date chooser's time picker

    SmartClient Version: SNAPSHOT_v11.1d_2017-02-06/Enterprise Development Only (built 2017-02-06)

    Chrome on OSX Sierra

    Hello, is it possible to set a default value for the time picker of a date chooser?

    I've tried this but it didn't work:

    Code:
    isc.DynamicForm.create({
        ID: "dateForm",
        numCols: 4,    
        width: 650,
        fields: [
            {
             name:"directInputDate", title:"Direct Input Date", editorType:"DateTimeItem", useTextField:true,
                 pickerTimeItemProperties:{
                   hourItemProperties:{defaultValue: 13}
                 }
            
            }
        ]
    });

    #2
    Does it work if you set the defaultValue directly on the pickerTimeItemProperties, for example, as "13:00"?

    Comment


      #3
      I've tried this, without success:
      Code:
      isc.DynamicForm.create({
          ID: "dateForm",
          numCols: 4,    
          width: 650,
          fields: [
              {
               name:"directInputDate", title:"Direct Input Date", editorType:"DateTimeItem", useTextField:true,
                   pickerTimeItemProperties:{
                     defaultValue: "13:00"
                   }
              }
          ]
      });

      Comment


        #4
        Hm, yes, unfortunately there is no easy way to do this at the moment - if the item has no value, the default for the DateChooser's timeItem is now.

        One way to achieve what you want (an arbitrary default time, in the absence of a current date-time value or default) might be with code like this, which overrides showPicker():

        Code:
        showPicker: function () {
            var result = this.Super("showPicker", arguments);
            if (!this.getValue()) {
                // no value in the dateTimeItem, override the default time in the DateChooser (which is now)
                this.picker.timeForm.getItem(0).setValue("13:35");
            }
            return result;
        }

        Comment


          #5
          Actually, you can just set item.defaultChooserDate, including the time portion you want.

          Comment


            #6
            thank you very much, this is working:

            Code:
            isc.DynamicForm.create({
                ID: "dateForm",
                numCols: 4,    
                width: 650,
                fields: [
                    {
                     name:"directInputDate", title:"Direct Input Date", editorType:"DateTimeItem", useTextField:true,
                         defaultChooserDate: isc.Time.createLogicalTime(13)
                   }
                ]
            });

            Comment

            Working...
            X