UI5 version: 1.63.1
sap.ui.define([
"sap/ui/core/mvc/Controller"
,"sap/ui/comp/valuehelpdialog/ValueHelpDialog"
,"sap/ui/model/json/JSONModel"
,"sap/m/ColumnListItem"
,"sap/ui/core/Fragment"
,"sap/ui/table/Table"
], function (Controller,ValueHelpDialog,JSONModel,ColumnListItem,Table,Fragment) {
"use strict";
return Controller.extend("cap.molex.Molex1_selfcodedProtoype.controller.CreateRequest", {
onInit: function () {
var oModel = new JSONModel("./model/mockData/valueHelpData.json");
this.getView().setModel(oModel);
},
getById: function (Id) {
return this.getView().byId(Id);
}
,onWarehouseHelp: function() {
if (!this._oValueHelpDialog) {
Fragment.load({
name: "cap.molex.Molex1_selfcodedProtoype.fragment.valueHelp",
controller: this
}).then(function(oValueHelpDialog){
this._oValueHelpDialog = oValueHelpDialog;
this.getView().addDependent(this._oValueHelpDialog);
this._configValueHelpDialog();
this._oValueHelpDialog.open();
}.bind(this));
} else {
this._configValueHelpDialog();
this._oValueHelpDialog.open();
}
}
,_configValueHelpDialog: function() {
var sInputValue = this.byId("inWarehouse").getValue(),
oModel = this.getView().getModel(),
aWarehouses = oModel.getProperty("/Warehouses");
aWarehouses.forEach(function (oWarehouse) {
oWarehouse.selected = (oWarehouse.Name === sInputValue);
});
oModel.setProperty("/Warehouses", aWarehouses);
}