Announcement

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

    selectValue of DateItem when useMask is true

    I have a DateItem with useTextBox true and useMask true
    since switching to using useMask true our users don't like that the text isn't initially selected on editor enter
    I see that the functions selectValue() and setSelectionRange() only work with freeform, is there any way for me to select the value when useMask is true?

    Thank you for your help

    SmartClient version (available on lower left of Developer Console)
    SmartClient Version: v11.0p_2017-02-16/Pro Development Only (built 2017-02-16)

    #2
    Try setting selectOnFocus:true via item.textFieldProperties - that will cause the entire value to be selected when entering the field via methods other than clicking at a specific location with the mouse.

    You could set selectOnClick in the same way, but there are complex interactions in cases like this, and you may see unexpected behaviors - let us know if you do.

    We're adding both attributes as passthroughs, so that setting them on the parent DateItem will be sufficient.

    Comment


      #3
      I didn't realize that there were textFieldProperties, good to know.
      I'm using selectOnClick, which is working great when the DateItem is in a DynamicForm but not when it's a ListGridField.

      Are there anything I need to know to make it work on a ListGrid?

      Comment


        #4
        Please show the code you're using

        Comment


          #5
          I set my defaults by using addProperties to the isc.Date object here https://pastebin.com/AzS5FRCW

          You'll notice that my potential solution to this is to override setSelectionRange and always set start = 0 and end = 999

          After setting my defaults, I instantiate a ListGrid with the field {name: "hireDate", type:"date", useTextField: true, editorType: "date"}

          Comment


            #6
            If you're setting these globally, try isc.DateItem.changeDefaults("textFieldDefaults", { ... }) - also, that override of setSelectionRange() will break builtin behaviors, so you should drop it.

            If this doesn't work, in let us know and we'll take a look.

            Comment


              #7
              Here is my sandbox test https://pastebin.com/ByHa86xu

              Regardless of its a DynamicForm or ListGrid, when you tab the fields for the first time it correctly selects the value on focus, but if you tab through a second time it will not select the value.

              The selectOnClick also has a weird nuance only with the ListGrid.
              When the grid is not in edit mode if you double-click the first field to start editing, you can click a date and it selects the value correctly.
              When the grid is not in edit mode if you double-click a date field to start editing, it will not select the value correctly.

              Comment


                #8
                When we run this sample exactly as-is, against the latest 11.0 code, we see none of these issues.

                Please update to the latest from smartclient.com/builds.

                Comment


                  #9
                  Confirmed.. Thank you for your help

                  Comment

                  Working...
                  X