cancel
Showing results for 
Search instead for 
Did you mean: 

sap.ui.commons.ComboBox problems

Former Member
0 Kudos

I want to use combobox function in xml.view

this is code

xml.view

<c:ComboBox id = "cbbox" items = "{/HHdata}" width = "200px" >
<c:items>
<core:Item key = "{key}" text = "{text}" />
</c:items>

</c:ComboBox>

controller.js

onInit: function() {
 

        var mData = {

        HHdata : [
        {
        "key" : "0",
        "text" : "All"
        },
        {
             "key" : "1",
             "text" : "Approval Request"
                  
        },
        {
        "key" : "2",
        "text" : "Approval in Progress"
        },
        {
        "key" : "3",
        "text" : "Approval Completed"
        },
        {
        "key" : "8",
        "text" : "Deleted"
        },
        {
        "key" : "9",
        "text" : "Rejected"
        }
                   ]

       

        };

       

       

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

        oJsonModel2.setData(mData, true);

        console.log(oJsonModel2);

        this.getView().byId("cbbox").setModel(oJsonModel2);

      //  sap.ui.getCore().setModel(oJsonModel);

   

},

error message

expert help this problem

Accepted Solutions (1)

Accepted Solutions (1)

vaibhav_singh12
Participant
0 Kudos

Replace <core:Item> with <core:ListItem>

<c:ComboBox id="cbbox" items="{/HHdata}">

      <c:items>

           <core:ListItem key="{key}" text="{text}"></core:ListItem>

      </c:items>

</c:ComboBox>

Answers (0)