DoubleT
DoubleT

Reputation: 77

SAPUI5 switch focus

In my code I have textarea and dropdown input with binded model data. When changing dropdown value textarea gets new value and changes its content. Problem is that I would like to focus to switch from dropdown to textarea.

Currently I have modified liveChange event like this:

flavorScriptsDDLB.liveChange = function(ev) {
    _scriptModel.setProperty("@selectedScript", textArea.getValue());
    _scriptModel.setSelectedScriptID(ev.getSource().getSelectedKey());
    textArea.setEnabled(true);
    textArea.focus();
};

but still dropdown keeps the focus instead of switching it to textarea. Found relative Question here, but it was unanswered also.

Upvotes: 1

Views: 5649

Answers (1)

sirion
sirion

Reputation: 1021

The re-rendering of the changed TextArea is done in a Timeout, add a timeout of your own to set focus:

See this for example: http://jsbin.com/cudogopuye/1/edit?html,js,output

Upvotes: 2

Related Questions