//..
"ActivitySetObjectPage": {
"type": "Component",
"id": "ActivitySetObjectPage",
"name": "sap.fe.templates.ObjectPage",
"options": {
"settings": {
"editableHeaderContent": false,
"controlConfiguration": {
"@com.sap.vocabularies.UI.v1.FieldGroup#General": {
"fields": {
"customFormElementIdentification1": {
"template": "activity.list.report.ext.fragment.CustomField",
"label": "Custom Form Element",
"position": {
"placement": "After",
"anchor": "DataField::be_invoiced"
}
}
}
}
}
}
}
}
//..
<core:FragmentDefinition
xmlns:core="sap.ui.core"
xmlns="sap.m"
xmlns:macros="sap.fe.macros"
>
<Switch
id="checkBoxOption2"
enabled="{ui>/isEditable}"
state="{be_invoiced}"
type="AcceptReject"
/>
</core:FragmentDefinition>
We need to change the manifest.json.
//...
"ActivitySetList": {
"type": "Component",
"id": "ActivitySetList",
"name": "sap.fe.templates.ListReport",
"options": {
"settings": {
"contextPath": "/ActivitySet",
"variantManagement": "Page",
"navigation": {
"ActivitySet": {
"detail": {
"route": "ActivitySetObjectPage"
}
}
},
"controlConfiguration": {
"@com.sap.vocabularies.UI.v1.SelectionFields": {
"showClearButton": true,
"filterFields": {
"activity_time": {
"label": "Activity Time",
"template": "activity.list.report.ext.fragment.CustomFilter",
"availability": "Default",
"position": {
"placement": "After",
"anchor": "activity_date"
}
}
}
}
}
}
}
},
//...
<core:FragmentDefinition
xmlns:core="sap.ui.core"
xmlns="sap.m"
>
<HBox
id="_IDGenHBox1234"
alignItems="Center"
width="100%"
core:require="{handler: 'activity/list/report/ext/controller/CustomFilter'}"
>
<StepInput
id="_IDGenStepInput1"
value="{path: 'filterValues>', type: 'sap.fe.macros.filter.type.Value', formatOptions: { operator: 'LE' }}"
min="0"
max="8"
step="2"
width="100px"
/>
<core:Icon
id="_IDGenIcon113212"
src="sap-icon://reset"
press="handler.onReset"
class="sapUiSmallMarginBegin"
/>
</HBox>
</core:FragmentDefinition>
sap.ui.define(
["sap/ui/model/Filter"],
function (Filter) {
"use strict";
return {
onReset: function (oEvent) {
this.setFilterValues("activity_time");
}
};
}
);
<core:FragmentDefinition
xmlns:core="sap.ui.core"
xmlns="sap.m"
xmlns:macros="sap.fe.macros"
xmlns:mc="sap.suite.ui.microchart"
>
<macros:Table
contextPath="/ActivitySet"
metaPath="to_today/@com.sap.vocabularies.UI.v1.LineItem"
id="LineItemTable"
headerVisible="false"
readOnly="true"
enableAutoColumnWidth="true"
>
<macros:columns>
<macrosTable:Column
id="_IDGenColumn1"
header="Activity Time/Day"
importance="High"
width="10em"
key="FirstColumnKey"
>
<mc:HarveyBallMicroChart
id="_IDGenHarveyBallMicroChart1"
size="XS"
total="8"
totalScale="hr"
>
<mc:items>
<mc:HarveyBallMicroChartItem
id="_IDGenHarveyBallMicroChartItem1"
fraction="{activity_time}"
color="Good"
fractionScale="hr"
/>
</mc:items>
</mc:HarveyBallMicroChart>
</macrosTable:Column>
</macros:columns>
</macros:Table>
</core:FragmentDefinition>
//..
"sap.ui5": {
"extends": {
"extensions": {
"sap.ui.controllerExtensions": {
"sap.fe.templates.ObjectPage.ObjectPageController": {
"controllerName": "activity.list.report.ext.OPExtend"
}
}
}
},
//..
sap.ui.define(
[
"sap/ui/core/mvc/ControllerExtension",
"sap/m/Dialog",
"sap/m/DialogType",
"sap/m/Text",
"sap/m/Button",
"sap/m/ButtonType",
"sap/m/MessageToast",
"sap/m/MessageBox"
],
function (ControllerExtension, Dialog, DialogType, Text, Button, ButtonType, MessageToast, MessageBox) {
"use strict";
return ControllerExtension.extend("activity.list.report.ext.OPExtend", {
// this section allows to extend lifecycle hooks or override public methods of the base controller
override: {
onInit: function () { },
editFlow: {
onBeforeSave: function (mParameters) {
var sTodayDate = new Date().toISOString().split('T')[0];
return this._createDialog("Activity Date will be changed with today's date.").then(() => {
mParameters.context.setProperty('activity_date', sTodayDate)
});
}
},
},
_createDialog: async function (sText, mParameters) {
return new Promise(function (fnResolve, fnReject) {
var oApproveDialog = new Dialog({
type: DialogType.Message,
title: "Confirm",
content: new Text({ text: sText }),
beginButton: new Button({
type: ButtonType.Emphasized,
text: "Continue",
press: function () {
oApproveDialog.close();
fnResolve();
}
}),
endButton: new Button({
text: "Cancel",
press: function () {
oApproveDialog.close();
fnReject();
}
}),
escapeHandler: (pCloseDialog) => {
pCloseDialog.resolve();
fnReject();
}
});
oApproveDialog.open();
});
}
});
}
);
Remember, Guided Development is another valuable tool that streamlines your app extension at various stages. It's a powerful aid in making your development process smoother and more efficient.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
6 | |
5 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |