diff --git a/app/featureShowcase/layouts_RootEntities.cds b/app/featureShowcase/layouts_RootEntities.cds index a06314c..4e63424 100644 --- a/app/featureShowcase/layouts_RootEntities.cds +++ b/app/featureShowcase/layouts_RootEntities.cds @@ -622,6 +622,7 @@ annotate service.RootEntities with @( annotate service.RootEntities with @( //Shown filters for the given fields after opening the application UI.SelectionFields : [ + country_code, stringProperty, fieldWithPrice, criticality_code, @@ -698,6 +699,32 @@ annotate service.RootEntities with @( Visualizations : ['@UI.LineItem#simplified'], }, }, + UI.SelectionPresentationVariant #DefaultFilter : { + SelectionVariant : { + SelectOptions : [ + { + PropertyName : country_code, + Ranges : [ + { + Sign : #I, + Option : #EQ, + Low : 'DE', + }, + { + Sign : #I, + Option : #EQ, + Low : 'FR', + }, + ], + }, + ], + }, + PresentationVariant : { + SortOrder : [ + ], + Visualizations : ['@UI.LineItem'], + }, + }, ); /** diff --git a/app/featureShowcase/webapp/Component.js b/app/featureShowcase/webapp/Component.js index 4dff293..ec5837f 100644 --- a/app/featureShowcase/webapp/Component.js +++ b/app/featureShowcase/webapp/Component.js @@ -1,4 +1,7 @@ -sap.ui.define(['sap/fe/core/AppComponent'], function(AppComponent) { +sap.ui.define([ + 'sap/fe/core/AppComponent', + 'sap/fe/featureShowcase/mainApp/control/FeatureShowcaseChildEntity2', // To ensure the custom control is loaded during templating +], function(AppComponent) { 'use strict'; return AppComponent.extend("sap.fe.featureShowcase.mainApp.Component", { diff --git a/app/featureShowcase/webapp/control/FeatureShowcaseChildEntity2.js b/app/featureShowcase/webapp/control/FeatureShowcaseChildEntity2.js new file mode 100644 index 0000000..256f9c1 --- /dev/null +++ b/app/featureShowcase/webapp/control/FeatureShowcaseChildEntity2.js @@ -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` + `; + }, + + // + init: function () { + this.attachPress(oEvent => { + MessageBox.show('I am a custom control, injected in a FE template'); + }); + }, + }); +}); diff --git a/app/featureShowcase/webapp/manifest.json b/app/featureShowcase/webapp/manifest.json index 0a4672a..0a3b62b 100644 --- a/app/featureShowcase/webapp/manifest.json +++ b/app/featureShowcase/webapp/manifest.json @@ -111,6 +111,7 @@ "entitySet": "RootEntities", "variantManagement": "Page", "enhanceI18n": "i18n/customI18N.properties", + "defaultTemplateAnnotationPath": "com.sap.vocabularies.UI.v1.SelectionPresentationVariant#DefaultFilter", "navigation": { "RootEntities": { "detail": { @@ -119,7 +120,7 @@ } }, "initialLoad": true, - "views": { + "XviewsX": { "paths": [ { "key": "tab1", diff --git a/app/index.html b/app/index.html index 09e2703..5e05a39 100644 --- a/app/index.html +++ b/app/index.html @@ -56,9 +56,9 @@ }; - +