-2
Ich bin neu auf SAPUI5 Entwicklung.SAPUI5 füllen Liste von model.read
Ich versuche eine Liste aus dem dymanischen Wert zu füllen.
Ausblick:
<mvc:View controllerName="porcoporcodio.controller.View1" xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc" xmlns:semantic="sap.m.semantic"
xmlns:m="sap.m" xmlns:footerbar="sap.ushell.ui.footerbar" xmlns:viz="sap.viz.ui5.controls" xmlns:layout="sap.ui.layout"
xmlns:commons="sap.suite.ui.commons" xmlns:core="sap.ui.core" xmlns:f="sap.ui.layout.form">
<App>
<pages>
<Page title="{i18n>title}">
<f:SimpleForm id="SimpleFormChange354" minWidth="1024" maxContainerCols="3" editable="true" layout="ResponsiveGridLayout" title="Voli"
labelSpanL="3" labelSpanM="3" emptySpanL="4" emptySpanM="4" columnsL="1" columnsM="1" class="editableForm">
<f:content>
<Label id="pene" text="Seleziona Compagnia Aerea " labelFor="combo1"></Label>
<ComboBox id="combo1" items="{/CarrierCollection}" selectionChange="onSelectionComboBox" showSecondaryValues= "true">
<core:ListItem key="{carrid}" text="{carrid}" additionalText = "{CARRNAME}" />
</ComboBox>
<Text id="Texto" >
</Text>
</f:content>
</f:SimpleForm>
<List id="lineItemsList" items="{
path: '/flightDetails'
}">
<items>
<StandardListItem
title="{carrid}"
description="{connid}"
/>
</items>
</List>
</Page>
</pages>
</App>
Controller:
sap.ui.define([
"sap/ui/core/mvc/Controller"
], function(Controller) {
"use strict";
return Controller.extend("porcoporcodio.controller.View1", {
onInit: function() {
var sServiceUrl = "/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/";
var oModel = new sap.ui.model.odata.v2.ODataModel({
serviceUrl: "/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/"
});
this.getView().setModel(oModel);
},
onSelectionComboBox: function(oEvent) {
var pene = oEvent.getParameter("selectedItem");
pene = pene ? pene.getText() : pene;
var oView = this.getView();
var sPath = "/CarrierCollection('" + pene + "')";
var oObject = oView.getModel().getObject(sPath);
var oTexto = oView.byId('Texto');
oTexto.setText(oObject.CARRNAME);
var oModel = new sap.ui.model.odata.v2.ODataModel({
serviceUrl: "/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/"
});
var oStandardListItem = new sap.m.StandardListItem({
title: "{carrid}",
description: "{connid}"
});
oModel.read(sPath + "/carrierFlights", {
method: "GET",
success: function(data) {
sap.m.MessageToast.show("fgfgfg");
var json1 = new sap.ui.model.json.JSONModel();
json1.setData({
carrierFlights: data
});
var oList = oView.byId('lineItemsList');
oList.setModel(json1);
oList.bindAggregation("items", "/carrierFlights", oStandardListItem);
},
error: function() {
sap.m.MessageToast.show("veveveeve");
}
});
}
});
});
oModel.read sieht aus wie Arbeit, indise Daten kann ich meine Platte, aber in List zeigen nichts
sehen Image mit Daten.
Wirklich Dank für die Hilfe.
Können Sie Ihre Daten hinzufügen? – Jaro
Bild mit Daten hinzugefügt –
Nicht genug. Haben Sie ein Beispiel für ein Datenlayout? Zum Beispiel habe ich dir meine Antwort geschickt (aData). – Jaro