Skip to Content
Former Member
Dec 14, 2015 at 02:59 PM

How can I bind not just selectable dropdown-menu items, but also the actually selected one?



I have a dropdown menu, where you can select the unit of the mass of a freight unit:

var oMassUnitInput = new sap.m.Select('massunit', {
     id : "massunit",
          items : {
          path : '/massunits',
          template : new sap.ui.core.Item({
               text : '{Text}',
               key : '{IdUnit}'
     change : [ function(oEvent) {
          var control = oEvent.getSource();
          }, this ]

It takes the items from the model. In the Gateway Service I created an entity /massunits for that.

On the page I have also many other dropdown-menus and textfields. They should be filled with data from the freight unit too.

Every dropdown-menu has his own path with selectable fields.

The problem is now:

How can I initialize the selected items with the correct data of my freight unit?

I already created another entity in the Gateway Service, which gives me the data, for example:

{ mass: 5, massunit : kg, volume : 3, volumeunit: cm3, ...}

Should I read them now from the Gateway Service with and set the selected Items of the dropdown-menus manually, or is there a way to not just bind the selectable items, but also the actually selected items?