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”.
There are getSelectionRange / setSelectionRange APIs available in JavaScript, but not yet documented. They will be documented and show up in SmartGWT soon.
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.
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.