Announcement

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

    Setting the caret position in TextItem

    Hello,

    I'm wondering about how to set the caret position in TextItem fields, or selection a range of characters in fields.

    Should this be done by writing direct javascript code?

    Case where I fell over this is this:
    a TextItem with a FocusHandler does something with setValue. But when this event has been done handling, the caret is moved back to the start from the input text. Whereas when a user clicks on the form item, the caret is usually set at the end, so I would like to set it at the end as well.


    Business case is fields with a unit e.g. "20 Km", when the user edits the field, he should only be able to change the "20", and when editing is done, the "Km" text should be put back after. With approach from above, user clicks in the field, "Km" goes away, but caret is set at front of the "20".


    regards,

    #2
    There are getSelectionRange / setSelectionRange APIs available in JavaScript, but not yet documented. They will be documented and show up in SmartGWT soon.

    Comment


      #3
      Allright, thanks. Will keep an eye out on the svn builds ;)

      Comment


        #4
        These API's have been added to SVN.

        Sanjiv

        Comment


          #5
          Tried it today and works perfectly!

          Thanks all

          Comment


            #6
            Hello,

            Do you have an estimation for the release date, or do you have a web page that contains the road map ?

            Thanks,

            --
            Antoine Larcher
            Heavenize

            Comment


              #7
              This is already available from SVN (see posts above).

              Comment


                #8
                Yes, but then it is a snapshot version.
                The thing is that I have to make a release version of my software (that uses smartgwt 1.2) very soon and then I cannot rely on a snapshot version, only on a release version.

                So, I would like to know if this feature will be included in smartgwt 1.3 (or 2.0) and if there is a roadmap somewhere on a website so I can planify my developments.

                Thank you very much,

                __
                Antoine Larcher
                Heavenize

                Comment


                  #9
                  Any fix that goes into SVN goes into the next release.

                  If you need patches, certified builds available on your timeline, or similar services that's a reason to purchase support.

                  Comment


                    #10
                    Ok, I will study this option.
                    Nevertheless, would you have an estimation of the release date of the next release ?

                    Thx,

                    __
                    Antoine Larcher
                    Heavenize SAS

                    Comment


                      #11
                      I tried to use textItem.setSelectionRange method to set caret position in TextItem but unfortunately it is not working.
                      I used it in TextAreaItem and it worked but in textItem I have found anything to set caret position.

                      Any idea?

                      Comment


                        #12
                        If you think you've discovered a bug, put together a standalone test case and report all details of how you're testing, as explained in the FAQ.

                        Comment

                        Working...
                        X