Skip to Content

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

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.


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Apr 16 at 10:09 AM

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

  • Apr 16 at 10:09 AM

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

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 16 at 10:51 AM

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

    Add comment
    10|10000 characters needed characters exceeded