Quantcast
Viewing all articles
Browse latest Browse all 4841

Re: set the value in UI5 DropDownBox

Hi Partheeban,

I tried using your code in my example, where I have just 1 dropdownbox and on changing the value in the dropdown, I always reset it to "C".

 

<!DOCTYPE html>

<html><head>

<!--- header code--->

<script>

  var oModel = new sap.ui.model.json.JSONModel();

  oModel.setData({

  Shift:[

  {Shift:"A"},

  {Shift:"B"},

  {Shift:"C"}],

  editable: true,

  tooltip: "Shift"});

  sap.ui.getCore().setModel(oModel);

 

 

 

  //Drop down box definition

  var oDropdownBox3 = new sap.ui.commons.DropdownBox("DropdownBox3");

  oDropdownBox3.bindProperty("tooltip", "/tooltip");

  oDropdownBox3.bindProperty("editable", "/editable");

  oDropdownBox3.setWidth("50px");

  oDropdownBox3.setModel(oModel);

  var oItemTemplate1 = new sap.ui.core.ListItem();

  oItemTemplate1.bindProperty("text", "Shift");

  oItemTemplate1.bindProperty("enabled", "enabled");

  oDropdownBox3.bindItems("/Shift", oItemTemplate1);

 

  oDropdownBox3.attachChange(setValueinDDB);

 

  function setValueinDDB() {

       var shift = "C";

       oDropdownBox3.setValue(shift);

  }

 

  oDropdownBox3.placeAt("content");

</script>

</head>

<body class='sapUiBody'>

  <div id='content'></div>

</body>

</html>

 

The above code works fine.

 

Can you please share the code that use on select and the part where you do setValue().

I don't get the reason for it to not work, but could be it is not done in the right place.

 

Regards,

Ria


Viewing all articles
Browse latest Browse all 4841

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>