Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9190

Dropdown Box Items not updated after OData model change

$
0
0

I've got HANA rev 69 and SAPUI5.

 

I have defined an OData service on a HANA table that has MODEL field as its primary key:

 

service {

"ROMAN"."T_MODELS" as "myModels";

}

 

Next I defined a Dropdown box in the view component of my MVC model:

 

var oDropdownBox2 = new sap.ui.commons.DropdownBox({

                        id: "dropDown2", tooltip: "Models",

                         change: ##### some actions for change ######

         });

var oModel = new sap.ui.model.odata.ODataModel("../../services/myModels.xsodata/", false); oDropdownBox2.setModel(oModel);

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

oItemTemplate2.bindProperty("text", "MODEL");

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

oDropdownBox2.bindItems("/myModels", oItemTemplate2);

 

Everything is pretty much by the book and actually works.

 

Next thing I have a stored procedure in HANA that changes contents of T_MODELS table, say, it adds a new line.

 

Expected behaviour from the Dropdown box -- I should see the new item appearing there. But I don't see it until I refresh the whole page. I tried to programmatically unbind and remove all items from that Dropdown box, refresh the model and bind again. To no avail:

 

oDropdownBox2.unbindItems();

oDropdownBox2.removeAllItems();

oDropdownBox2.setModel(oModel);

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

oItemTemplate2.bindProperty("text", "MODEL");

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

oDropdownBox2.bindItems("/myModels", oItemTemplate2);

 

I have other controls on the screen, e.g. Table, that have bindings to that model, and I see that their data gets updated. So either I'm missing something specifically about how to handle a Dropdown box, or there is a bug. Any ideas?


Viewing all articles
Browse latest Browse all 9190

Trending Articles



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