Skip to Content

sap.m.input suggestItem suggestionItemSelected event is problem

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
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Apr 27, 2017 at 08:04 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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.