Skip to Content
0

How to call and bind an XS odata to a combobox in sapui5?

Apr 16 at 09:21 AM

59

avatar image

Hi all,

I have a comboBox control for which I need to bind an XS odata. I tried the usual way of binding an odata to combobox. But the data is not binded to the comboBox. Is there anything I need to change? Can someone help me with this?

Here's the code:

View:

<ComboBox  id="myList1" placeholder="Select Value" selectionChange="SelectChange"  items="{ path: '/ZS4HCDS_SEL_V01_DROPDOWNSet' }">
 <core:Item key="{FieldName}" text="{FieldName}" />
 </ComboBox>

Here's the output screenshot:

Regards,

Ramya.


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

3 Answers

Nicholas Owen O’Malley Apr 16 at 10:09 AM
1

Are you binding the data to the combobox in the controller?

if you are creating a model to bind, and not directly binding it to the ComboBox you need to specify what model you are binding in the xml.

this.getView().setModel("ModelName", data);


<ComboBox selectionChange="change" id="combo-box" width="100%" items="{ path: 'ModelName>/ZS4HCDS_SEL_V01_DROPDOWNSet' }"> <core:Item key="{ModelName>FieldName}" text="{ModelName>FieldName}"/> </ComboBox>
Share
10 |10000 characters needed characters left characters exceeded
Giri Sreerangam Apr 16 at 10:09 AM
1

Hope you are getting the data, when u call the xsodata from a browser? Just to make sure your odata service is defined correctly

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

Yes I get the data when I run the XS odata in Browser.

0
Ramya Ramasamy Apr 16 at 10:51 AM
0

Actually, there was some problem with my controller code.Now I'm able to get it. Thanks guys!!

Share
10 |10000 characters needed characters left characters exceeded