Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
17
rated 0 times [  21] [ 4]  / answers: 1 / hits: 37298  / 9 Years ago, fri, october 16, 2015, 12:00:00

i have the following Problem:



I have 2 XML Views with a few input fields and at navigation to the second view the focus should be on the 5th(ID = RueckmeldeNr) field.



I tried several things but nothing worked..
If i use the jQuery delayedCall the focus shortly flashes on the input field but is instantly set to the NavBack Button in the upper left corner.

Do i use the method false or forget something? How can i solve this?



onAfterRendering : function(oEvent) {
oInputRueck = this.getView().byId(RueckmeldeNr);
// this.getView().byId(RueckmeldeNr).focus();
// this.getView().byId(RueckmeldeNr).$().focus();
// jQuery.sap.delayedCall(200, this, function() {
// //this.getView().byId(RueckmeldeNr).focus();
// oInputRueck.focus();
// });
// var oFocusInfo = this.getView().byId(RueckmeldeNr).getFocusInfo()
// this.getView().byId(RueckmeldeNr).applyFocusInfo(oFocusInfo);
jQuery.sap.delayedCall(0, this, function() {
oInputRueck.focus();
});
},


I hope you can help me!

Thank you


More From » sapui5

 Answers
13

Just a suggestion:



You could set focus to the required field in the view (or where ever you define it).



For example, in view1 you define:



var oInput = new sap.m.Input({id: inputID})
.addEventDelegate({
onAfterRendering: function(){
oInput.focus();
}
});


and then, when you call the view, the focus should be set to the required field automatically.



Here is a working JSBIN example: LINK


[#64714] Wednesday, October 14, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
juliettec

Total Points: 327
Total Questions: 127
Total Answers: 102

Location: Bangladesh
Member since Sat, Jan 23, 2021
3 Years ago
;