Skip to Content
1

Selected key on sap.m.Input not reflected on loading page

Nov 09, 2017 at 09:47 PM

97

avatar image
Former Member

I'm having nearly identical issues as described in this post:

https://archive.sap.com/discussions/thread/3498176

However, in my case, the sap.m.Select elements are loading correctly, but a sap.m.Input element is not using the selected key I provide and defaulting to an empty input box. (The input element shows the correct data upon nav back and forth, which was also mentioned in the above post).

I was wondering if there was an update to sap.m.Select to address this issue that wasn't made to the sap.m.Input element. Also, how can I force the Input to show the element with the selectedKey I provided?

More details :

I am filling an Input field with suggestionItems from one service, and using a key from another service (both services have this key) to set the selectedKey value. This does not work upon the initial load, but if any change is made later on, it works.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

avatar image
Former Member Feb 23 at 12:09 PM
0

I have the same issue. Looks like the only workaround is onetime binding for value property. Any other suggestions?

Francesco, did you solved this issue?

BR,

Denis

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Code please

0
Former Member

I ended up using a ComboBox, which works without any modification of code (even though SAP Fiori guidelines suggest using an Input element for the number of elements I expect in actual use). It worked so I_hadn't really thought about trying to make the Input work

0
Bernard Le Tourneur Feb 23 at 01:08 PM
0

It's always so hard to assist without exposing your code.

Your input should appear as below (obviously apply your own contextualizations):

<Input
   id="inputModel"
   type="Text"
   placeholder="Insert the Model and Model Details"
   valueLiveUpdate="true"
   valueStateText="Model must have a value - minimum 3 characters - maximum 80"
   value="{
       path : 'asset>/Model' ,
       type : 'sap.ui.model.type.String',
       constraints : {
            minLength: 3,
            maxLength: 80
       }
   }" />


Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member
<Input 
	valueLiveUpdate="true" 
	liveChange="_validateSaveEnablement" 
	enabled="true" 
	visible="true"
	suggestionItems="{shlp>/VesselsListSet}" 
	showSuggestion="true" 
	selectedKey="{VESSEL}">
	<suggestionItems>
		<core:ListItem key="{shlp>Vessel}" text="{shlp>VesselName}" additionalText="{shlp>Vessel}"/>
	</suggestionItems>
</Input>

the trick is the correct key from suggestions goes as value after selection, but initial page load displays nothing. when value bound to VESSEL there will be vessel code instead of name.

BR,

Denis

0

Can you help me understand the binding for selectedKey? Why would you not simply set the value to {Vessel}? I presume you have an un-named model in context?

0
Former Member
Bernard Le Tourneur

no, i have two models. first for search helps, second for the form. regarding binding, search help model consists of two fields: Vessel (which is ID) and VesselName.

now, the idea is allow user to see and select by vesselname and keep vessel ID behind. the same way as it works for combobox. i've discovered that it works but only when second model loads. if i enter form, quit and enter again Vessel name appears, but it's empty on the very first entry.

BR,

Denis

0