I have a DynamicForm with a TextField placed in it. They are in a custom controller’s view (like a form).
When user types some text in this field, the ListGrid with available(suitable) textvalues is shown.
This ListGrid retrieves data from server through DataSource fetching. In dataArrived event I have some logic, and make a decision to send another server request or not, and put focus into TextField.
form.focusInItem(item);
Strange behaviour takes place in IE. After data arrives, cursor is put at the very beginning of the TextField.
In Mozilla, Chrome after data arrives, textfield can lost focus(even after being focused). And focus is placed somewhere else(somewhere between textField and advice grid). I can Tab to next control on my controller’s view and then Shift+Tab back to the TextField.
Have no idea why it happens. Can’t see anything strange while debugging it.
Maybe someone faced a problem like this with SmartGWT text controls?
Reasons for this strange behaviour were found.
Taken from from FormItem.js
So, after server returns us a portion of data(dataArrived event), the data fetched into
ListGridandTextFieldlost focus. When we manually put focus back to text field(form.focusInItem(item);), the selection is (0,0) – the beginning of the field. But only in IE. So we must save last selection before fetching data and then apply this selection after focus was manually put back to the text field.And after all data operations and before putting focus and setting selection we must do
form.redraw();