Привет, я пытаюсь извлечь данные из службы Odata, мое требование - когда выбрать строку, используя значениеHelpDialog, получить выбранные данные строки в несколько полей ввода.Fetch valueHelpDialog данные строки в несколько полей
выход поиска справки:
выбранный идентификатор попал в одно поле, но как мое требование хотят попасть в оставшиеся 2 поля также и мой код прилагается ниже:
<View
xmlns="sap.m"
xmlns:l="sap.ui.layout"
xmlns:core="sap.ui.core"
xmlns:mvc="sap.ui.core.mvc"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:f="sap.ui.layout.form"
controllerName="Navigation.controller.View2">
<Page
title="Second Page"
showNavButton="true"
navButtonPress="onBack">
<content>
<l:VerticalLayout
class="sapUiContentPadding"
width="100%">
<Label text= "Orderinput" width="300px"/>
<MultiInput id= "input" showValueHelp= "true" width="300px" valueHelpRequest= "handlef4"/>
<l:HorizontalLayout>
<Label text="planPlant" />
<Input id="InputNoEdit" class="sapUiSmallMarginBottom" type="Text"
enabled="True" editable="false" width="300px"/>
<Label text="Description" />
<Input id="InputNoEdit2" class="sapUiSmallMarginBottom" type="Text"
enabled="True" editable="false" width="300px"/>
</l:HorizontalLayout>
<l:HorizontalLayout>
<Label text="Product not editable" />
<Input id="InputNoEdit3" class="sapUiSmallMarginBottom" type="Text"
enabled="True" editable="false" width="300px"/>
<Label text="Product editable" />
<Input id="InputEdit1" class="sapUiSmallMarginBottom" type="Text"
enabled="true" editable="true" width="300px"/>
</l:HorizontalLayout>
<l:HorizontalLayout>
<Label text="Product editable" />
<Input id="InputEdit2" class="sapUiSmallMarginBottom" type="Text"
enabled="true" editable="true" width="300px"/>
<Label text="simple DatePicker" labelFor="DP1"/>
<DatePicker
id="DP1"
placeholder="Enter Date ..."
change="handleChange"
class="sapUiSmallMarginBottom"/>
</l:HorizontalLayout>
<l:HorizontalLayout>
<Button type="Accept"
text="Accept"
press="onPress"
ariaDescribedBy="acceptButtonDescription genericButtonDescription"/>
<Button type="Cancel"
text="Cancel"
press="onPress2"
ariaDescribedBy="acceptButtonDescription genericButtonDescription"/>
</l:HorizontalLayout>
</l:VerticalLayout>
<!--</f:SimpleForm>-->
</content>
</Page>
код контроллера:
jQuery.sap.require("sap.ui.comp.valuehelpdialog.ValueHelpDialog");
sap.ui.define([
"sap/ui/core/mvc/Controller", "sap/ui/core/routing/History"
], function(Controller, History) {
"use strict";
return Controller.extend("Navigation.controller.View2", {
handlef4: function(){
var oInput = sap.ui.getCore().byId("__xmlview1--input");
var oInput2 = sap.ui.getCore().byId("__xmlview1--planPlant");
if(!this._oValueHelpDialog){
this._oValueHelpDialog = new sap.ui.comp.valuehelpdialog.ValueHelpDialog("idValueHelp",{
supportMultiselect: false,
supportRangesOnly: false,
stretch: sap.ui.Device.system.phone,
keys: "Orderid",
descriptionKey: "Orderid",
filtermode: "true",
ok: function(oEvent){
var aTokens = oEvent.getParameter("tokens");
oInput.setTokens(aTokens);
this.close();
},
cancel: function(){
this.close();
}
});
}
var oFilterBar = new sap.ui.comp.filterbar.FilterBar({
advancedMode: true,
// filterBarExpanded: false,
filterBarExpanded: true,
showGoOnFB: !sap.ui.Device.system.phone,
filterGroupItems: [new sap.ui.comp.filterbar.FilterGroupItem({ groupTitle: "foo", groupName: "gn1", name: "n1", label: "Orderid", control: new sap.m.Input()}),
new sap.ui.comp.filterbar.FilterGroupItem({ groupTitle: "foo", groupName: "gn1", name: "n2", label: "Description", control: new sap.m.Input()}),
new sap.ui.comp.filterbar.FilterGroupItem({ groupTitle: "foo", groupName: "gn1", name: "n3", label: "Planplant", control: new sap.m.Input()})],
search: function(oEvt) {
var oParams = oEvt.getParameter("selectionSet");
var iOrder = oParams[0].getValue();
var iType = oParams[1].getValue();
var iPlan = oParams[2].getValue();
// sap.m.MessageToast.show("Search pressed '");
oTable.bindRows({path: "/OrderDataSet", filters: [
new sap.ui.model.Filter("Orderid",sap.ui.model.FilterOperator.EQ, iOrder),
new sap.ui.model.Filter("Description",sap.ui.model.FilterOperator.EQ, iType),
new sap.ui.model.Filter("Planplant",sap.ui.model.FilterOperator.EQ, iPlan)]
});
}
});
this._oValueHelpDialog.setFilterBar(oFilterBar);
var oColModel = new sap.ui.model.json.JSONModel();
oColModel.setData({
cols: [
{label: "Orderid", template: "Orderid"},
{label: "Description", template: "Description"},
{label: "Planplant", template: "Planplant"}
]
});
var oTable = this._oValueHelpDialog.getTable();
oTable.setModel(oColModel,"columns");
var oModel = new sap.ui.model.odata.ODataModel("/sap/opu/odata/SAP/ZP01_FIORI_SRV_01/");
oTable.setModel(oModel);
this._oValueHelpDialog.open();
},
onBack : function() {
var sPreviousHash = History.getInstance().getPreviousHash();
if (sPreviousHash !== undefined) {
window.history.go(-1);
} else {
this.getOwnerComponent().getRouter().navTo("page1", null, true);
}
}
});
});