Hi , I have a design in which my table has a combobox on Material field and when the table shows initially it should only one value (coming from odata). right now the code I added shows all the material of the odata as dropdown.
success: function (data, response)
{ that.getView().getModel("appModel").setProperty("/returnOrderDetails", data.results); //var returnOrderDetails = that.getView().getModel("appModel").getProperty("/returnOrderDetails"); var arrayData; var array = []; for (var i = 0; i < data.results.length; i++) {
arrayData = { id: data.results[i].Material }
array.push(arrayData); //data.results[i].Material = array; //array.splice(0,array.length); } var jsondata = { items: array } var jsonModel = new sap.ui.model.json.JSONModel(); jsonModel.setData(jsondata); that.getView().setModel(jsonModel, "matModel"); // array.splice(0,array.length); //odef.setModel(jsonModel,"matModel");
It should not show 10192049 in first row as it is second lines material.Second line shows both the materials with focus on second material.
View : <ComboBox id="mat" width="100%" items="{ path: 'matModel>/items'}" selectionChange="onSelectionChange" selectedKey="{appModel>Material}" selectedItem=""> <core:Item key="{matModel>id}" text="{matModel>id}"/> </ComboBox>
Controller
