Skip to Content

How to bind odata values to a combobox or dropdownbox which is enclosed in sap.ui.table.Table ?

Hi all,

I have a combobox or dropdownbox inside sap.ui.table.Table. I try to bind the odata to the combobox / Dropdownbox. But the values from odata is not getting binded to it.

Here's my view code :

<ui:Column width="10rem" hAlign="Center">
<Label text="Vessel Name" wrapping="true" required="true"/>
<ui:template>
<ComboBox id="idship_Vesname"   placeholder="Select vessel" items="{/MyFleet}">
  <items>  
 <core:Item key="{VESSELNAME}" text="{VESSELNAME}" />
 </items>
</ComboBox>
</ui:template>
</ui:Column>

For dropdownbox:

<ui:Column width="10rem" hAlign="Center">
<Label text="Vessel Name" wrapping="true" required="true"/>
<ui:template>
<c:DropdownBox items="{
 path: '/MyFleet',
 sorter: { path: 'VESSELNAME' }}">
<core:ListItem key="{VESSELNAME}" text="{VESSELNAME}" />
  </c:DropdownBox>
</ui:template>
</ui:Column>

I tried binding from controller also. But the value is not getting binded to combobox/dropdownbox. Can someone help me with this?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Jul 02, 2018 at 12:32 PM

    your model has no name?

    Add comment
    10|10000 characters needed characters exceeded

    • Hi,

      The odata entity set here is path:'/MyFleet' and VESSELNAME is the odata field name . I guess this is the way to map odata in xml view. could you be please more clear about what model you are asking?

  • Jul 03, 2018 at 12:15 PM

    your table data and drowndown data coming from same model?

    Add comment
    10|10000 characters needed characters exceeded

    • <ComboBox items="{  path: '/MyFleet', sorter: { path: 'VESSELNAME' }}" templateShareable="false">
          <core:Item key="{VESSELNAME}" text="{VESSELNAME}" />
           </ComboBox>

      you have to give a name to your second model