on 2017 Apr 27 7:10 AM
Hi Experts,
To build the Fiori application of SAPUI 5,
I am trying to realize a suggestion function using suggestItem of sap.m.input.
Therefore, when implementing and executing the suggestionItemSelected event,
I succeed in choosing the first suggestion list,
I have encountered an obstacle in which selectedItem is set to null for the second time.
<xml>
<Input id="itxtVkorg"
maxSuggestionWidth="800px"
type="Text"
showSuggestion="true"
suggestionItems="{ path: '/ZTVKO01Set', sorter: { path: 'Vkorg' } }"
suggestionItemSelected="onSelectItemVkorg"
ariaLabelledBy="lblVkorg"
>
<suggestionItems>
<core:ListItem key="{Vkorg}" text="{Vkorg}" additionalText="{Vtext}"/>
</suggestionItems>
</Input>
<Text id="txtVkorg" text=""/>
<js>
onSelectItemVkorg: function(oEvent) {
// var ctl = sap.ui.getCore().byId("itxtVkorg");
var item = oEvent.getParameter("selectedItem");
// var key = item.getKey();
var text = item.getAdditionalText();
// sap.ui.getCore().byId("itxtVkorg").setValue(key);
sap.ui.getCore().byId("txtVkorg").setText(text);
},
Do you know anything, workaround?
Regards
Request clarification before answering.
Hi Akitaka Shimizu,
Are you saying when you select your second Item from the suggestion list , the selected value is coming null or you want to null the selected Item .. please can you elaborate your problem
thanks
Viplove
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Viplov.
My problem is the second choice of a suggestion list,
(the selected value is coming null)
var item = oEvent.getParameter ("selectedItem");
Item is null.
It is an assumption that the "Class sap.ui.core.ListItem" of the second selected suggestionList will be returned correctly.
Regards.
Thanks Viplov.
In fact, the same phenomenon occurs even in the following samples, so please take a look, if you like.Put "h" in the text, 1 time 2 times An error will occur.
http://jsbin.com/gonafimapu/edit?html,js,console,output
Regards.
Error comes like this after selecting first time from the suggested item , if we type anything in the input and remove focus from the input control it calls suggestionItemSelected event , which it should not call until and unless and item is selected. But for you why that's a problem, you can ignore that. What you can do if you still don't want to get that issue.You can just check if the value is not null than only get the additional text like this :
var item = oEvent.getParameter("selectedItem");
If (item !== null){
var text = item.getAdditionalText();
sap.ui.getCore().byId("txtVkorg").setText(text);
}
Thanks
Viplove
Hi Viplove
sorry for the late reply.
To the contents taught, plus Without using suggestionItems, By using suggestionRows,
I confirmed that a null value will not be returned.
Thank you, I was rescued by my reply.
User | Count |
---|---|
49 | |
6 | |
5 | |
5 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.