Skip to Content

How to Bind Odata in json to combo Box?

Hi All,

i am new sap ui5 started developing UI5 app,but stuck at DAta binding in combo box.

DAta is coming from sap server as odata in json format.

Please provide any quick solution where i done wrong??

the XML View

The Odata in JSON in Console.

Thanks

Surya

viewxml.png (5.3 kB)
odata-in-json.png (19.1 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Dec 27, 2017 at 04:49 AM

    Hi surya prakash tanguturi,

    Could you try setting your model to the particular view specifically.

    Regards,

    Arjun Biswas

    Add comment
    10|10000 characters needed characters exceeded

    • Hi surya prakash tanguturi,

      Yes, you can attach another model to the same view, by giving the model an alias name.

      this.getView().setModel(modelObject); //Sets your default model
      this.getView().setModel(modelObject1,"firstModel"); //Sets another model to your view
      //To get data from these models :
      this.getView().getModel().getData(); //get default model data
      this.getView().getModel("firstModel").getData(); //gets data of the second model

      Hope this helps,

      Regards,

      Arjun Biswas

  • Dec 26, 2017 at 04:29 PM

    There is little less information in order to comment on this.

    Could you please share your manifest file as well.
    Would like to the model which is bound to the view.

    Also, do you see any error in the console ?

    Add comment
    10|10000 characters needed characters exceeded

    • var sServiceUrl = "proxy/http/122.165.148.177:8000/sap/opu/odata/sap/ZUI5_SURYA_SRV"

      var user = "";

      var pass = "";

      var oModel1 = new sap.ui.model.odata.ODataModel(sServiceUrl,true,user,pass);

      var oJsonModel =new sap.ui.model.json.JSONModel(oModel1); oModel1.read("/EmployeeDetailsSet",null,null,true,function(oData,response){ oJsonModel.setData(oData); })

      var res = sap.ui.getCore().setModel(oJsonModel);

      Above is my contoller.js

      i an simply using controller and a view no manifest.json . i want my json to be as a dropdown in combobox.

      output.png (5.3 kB)