"I have a function that works perfectly and returns all the data from the server, but it doesn't display it in the browser. There seems to be something wrong with the display code, probably related to 'model2', which it doesn't recognize."
it is the function:
callServiceDetails:function(oEvent){ var that2 = this; var view = this.getView(); var testModel2 = this.getOwnerComponent().getModel(); // var NumOrderMichal= oEvent.getSource.getBindingContext(""). var filters= [new Filter("IvNumberOrder", FilterOperator.EQ, window.NumOrderMichal)]; testModel2.read("/ZGET_ORDER_LINE_BY_ID_MICHALSet",{ filters: filters, success: function (data) { var DataModel2 = new sap.ui.model.json.JSONModel({ Data: data.results[0],
}); that2.getView().setModel(DataModel2, "myModel2"); this.getView().getModel("myModel2").refresh();
}, error: function (error) { console.log("!!!!**********!!!!!!") }, })}
it is the code in the view:
<Panel expandable="true" headerText="✏️" width="240PX" class="sapUiResponsiveMargin" > <content> <VBox> <Button press="callServiceDetails"> </Button> <Input value="{myModel2>/NumOrderMichal}" description="מספר מוצר" showClearIcon="true" /> <Input value="{myModel2>/ZorderTypeMichal}" description="סוג הזמנה" showClearIcon="true" id="myInput1"/> <Input value="{myModel2>/NumProductMichal}" description="מספר פריט" showClearIcon="true" /> <Input value="{myModel2>/ProductDescriptionMichal}" description="תיאור פריט" showClearIcon="true" /> <Input value="{myModel2>/PriceMichal}" description="מחיר" showClearIcon="true" /> <Input value="{myModel2>/AmountMichal}" description="כמות" showClearIcon="true" /> <Button text="שמור שינויים" press="editingDetails" /> </VBox> </content> </Panel>