Skip to content

Commit 70ad9ae

Browse files
1 parent 4c2757b commit 70ad9ae

File tree

2 files changed

+81
-2
lines changed

2 files changed

+81
-2
lines changed

app/webapp/controller/App.controller.js

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,85 @@ sap.ui.define("z2ui5/MultiInputExt", ["sap/ui/core/Control", "sap/m/Token", "sap
695695
}
696696
);
697697

698+
sap.ui.define("z2ui5/SmartMultiInputExt", ["sap/ui/core/Control", "sap/m/Token", "sap/ui/core/Core", "sap/ui/core/Element"], (Control) => {
699+
"use strict";
700+
701+
return Control.extend("z2ui5.SmartMultiInputExt", {
702+
metadata: {
703+
properties: {
704+
multiInputId: {
705+
type: "String"
706+
},
707+
addedTokens: {
708+
type: "Array"
709+
},
710+
removedTokens: {
711+
type: "Array"
712+
},
713+
rangeData: {
714+
type: "Array"
715+
},
716+
checkInit: {
717+
type: "Boolean",
718+
defaultValue: false
719+
}
720+
},
721+
events: {
722+
"change": {
723+
allowPreventDefault: true,
724+
parameters: {}
725+
}
726+
},
727+
},
728+
729+
init() {
730+
z2ui5.onAfterRendering.push(this.setControl.bind(this));
731+
},
732+
733+
onTokenUpdate(oEvent) {
734+
this.setProperty("addedTokens", []);
735+
this.setProperty("removedTokens", []);
736+
737+
if (oEvent.mParameters.type == "removed") {
738+
let removedTokens = [];
739+
oEvent.mParameters.removedTokens.forEach((item) => {
740+
removedTokens.push({
741+
KEY: item.getKey(),
742+
TEXT: item.getText()
743+
});
744+
}
745+
);
746+
this.setProperty("removedTokens", removedTokens);
747+
} else {
748+
let addedTokens = [];
749+
oEvent.mParameters.addedTokens.forEach((item) => {
750+
addedTokens.push({
751+
KEY: item.getKey(),
752+
TEXT: item.getText()
753+
});
754+
}
755+
);
756+
this.setProperty("addedTokens", addedTokens);
757+
}
758+
this.setProperty("rangeData", oEvent.getSource().getRangeData());
759+
this.fireChange();
760+
},
761+
renderer(oRm, oControl) { },
762+
setControl() {
763+
const input = z2ui5.oView.byId(this.getProperty("multiInputId"));
764+
if (!input) {
765+
return;
766+
}
767+
if (this.getProperty("checkInit") == true) {
768+
return;
769+
}
770+
this.setProperty("checkInit", true);
771+
input.attachTokenUpdate(this.onTokenUpdate.bind(this));
772+
}
773+
});
774+
}
775+
);
776+
698777
sap.ui.define("z2ui5/CameraPicture" , [
699778
"sap/ui/core/Control",
700779
"sap/m/Dialog",

app/webapp/controller/View1.controller.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/
242242
}
243243
break;
244244
case 'SET_ODATA_MODEL':
245-
var oModel = new ODataModel({ serviceUrl : args[1] });
245+
var oModel = new ODataModel({ serviceUrl : args[1], annotationURI: (args.length > 3 ? args[3] : '') });
246246
z2ui5.oView.setModel( oModel , args[2] );
247247
break;
248248
case 'DOWNLOAD_B64_FILE':
@@ -473,7 +473,7 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/
473473
let oview_model = new JSONModel(viewModel);
474474
var oModel = oview_model;
475475
if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCH_DEFAULT_MODEL_PATH){
476-
oModel = new ODataModel({ serviceUrl : z2ui5.oResponse.PARAMS.S_VIEW?.SWITCH_DEFAULT_MODEL_PATH });
476+
oModel = new ODataModel({ serviceUrl : z2ui5.oResponse.PARAMS.S_VIEW?.SWITCH_DEFAULT_MODEL_PATH, annotationURI: z2ui5.oResponse.PARAMS.S_VIEW?.
477477
}
478478
z2ui5.oView = await XMLView.create({
479479
definition: xml,

0 commit comments

Comments
 (0)