-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hook custom control into FE Templating process
- Loading branch information
Carl Önnheim
committed
Nov 28, 2023
1 parent
add7347
commit ab2fa8d
Showing
3 changed files
with
896 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
app/featureShowcase/webapp/control/FeatureShowcaseChildEntity2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
sap.ui.define([ | ||
'sap/m/Link', | ||
'sap/fe/macros/field/FieldTemplating', | ||
'sap/m/MessageBox', | ||
], function ( | ||
Link, | ||
FieldTemplating, | ||
MessageBox, | ||
) { | ||
'use strict'; | ||
|
||
return Link.extend("sap.fe.featureShowcase.mainApp.control.FeatureShowcaseChildEntity2", { | ||
metadata: { | ||
manifest: "json" | ||
}, | ||
renderer: {}, | ||
|
||
// Implement the interface dictated by the templating process | ||
getTemplate: function (xml, internalField) { | ||
const text = FieldTemplating.getTextBinding(internalField.dataModelPath, internalField.formatOptions, true); | ||
|
||
return xml`<myApp:FeatureShowcaseChildEntity2 | ||
xmlns="sap.m" | ||
xmlns:myApp="sap.fe.featureShowcase.mainApp.control" | ||
xmlns:core="sap.ui.core" | ||
id="${internalField.noWrapperId}" | ||
text="${text}" | ||
visible="${internalField.displayVisible}" | ||
wrapping="${internalField.wrap === undefined ? true : internalField.wrap}" | ||
ariaLabelledBy="${internalField.ariaLabelledBy}" | ||
emptyIndicatorMode="${internalField.emptyIndicatorMode}" | ||
customData:loadValue="${internalField.valueAsStringBindingExpression}" | ||
> | ||
</myApp:FeatureShowcaseChildEntity2>`; | ||
}, | ||
|
||
// | ||
init: function () { | ||
this.attachPress(oEvent => { | ||
MessageBox.show('I am a custom control, injected in a FE template'); | ||
}); | ||
}, | ||
}); | ||
}); |
Oops, something went wrong.