"extends": {
"extensions": {
"sap.ui.controllerExtensions": {
"sap.ovp.app.Main": {
"controllerName": "demo.ovp.BusinessOverview.ext.custom"
}
},
"sap.ui.viewExtensions": {
"sap.ovp.app.Main": {
"SmartFilterBarGlobalActionExtension": {
"className": "sap.ui.core.Fragment",
"fragmentName": "demo.ovp.BusinessOverview.ext.customAction",
"type": "XML"
}
}
}
}
},
<core:FragmentDefinition xmlns="sap.m" xmlns:smartfilterbar="sap.ui.comp.smartfilterbar" xmlns:core="sap.ui.core">
<Button text="Action1" press="handleCustomAction" type="Transparent"></Button>
<Button text="Action2" press="handleCustomAction" type="Transparent"></Button>
</core:FragmentDefinition>
handleCustomAction: function () {
var msg = 'Custom Global Action clicked';
MessageToast.show(msg);
}
"SmartFilterBarControlConfigurationExtension|GlobalFilters": {
"className": "sap.ui.core.Fragment",
"fragmentName": "demo.ovp.BusinessOverview.ext.customFilter",
"type": "XML"
}
getCustomFilters: function () {
var oValue1 = this.oView.byId("ProductID").getValue();
var oValue2 = this.oView.byId("SalesOrderID").getValue();
var aFilters = [],
oFilter1, oFilter2;
if (oValue1) {
oFilter1 = new Filter({
path: "ProductID",
operator: "EQ",
value1: oValue1
});
aFilters.push(oFilter1);
}
if (oValue2) {
oFilter2 = new Filter({
path: "SalesOrderID",
operator: "EQ",
value1: oValue2
});
aFilters.push(oFilter2);
}
if (aFilters && aFilters.length > 0) {
return (new Filter(aFilters, true));
}
},
getCustomAppStateDataExtension: function (oCustomData) {
var oCustomField1 = this.oView.byId("ProductID");
var oCustomField2 = this.oView.byId("SalesOrderID");
if (oCustomField1) {
oCustomData.ProductID = oCustomField1.getValue();
}
if (oCustomField2) {
oCustomData.SalesOrderID = oCustomField2.getValue();
}
return oCustomData;
},
restoreCustomAppStateDataExtension: function (oCustomData) {
var oCustomField1 = this.oView.byId("ProductID");
oCustomField1.setValue();
var oCustomField2 = this.oView.byId("SalesOrderID");
oCustomField2.setValue();
if (oCustomData) {
if (oCustomData.ProductID) {
oCustomField1.setValue(oCustomData.ProductID);
}
if (oCustomData.SalesOrderID) {
oCustomField2.setValue(oCustomData.SalesOrderID);
}
}
},
modifyStartupExtension: function (oCustomSelectionVariant) {
oCustomSelectionVariant.addSelectOption("SupplierName", "I", "EQ", "Talpa");
},
"card01": {
"model": "GWSAMPLE_BASIC",
"template": "sap.ovp.cards.list",
"settings": {
"title": "{{card01_title}}",
"subTitle": "Standard List card - Standard flavour",
"entitySet": "ProductSet",
"listType": "condensed",
"listFlavor": "standard",
"sortBy": "Availability_Status",
"sortOrder": "Descending",
"annotationPath": "com.sap.vocabularies.UI.v1.LineItem",
"identificationAnnotationPath": "com.sap.vocabularies.UI.v1.Identification#productHeader1",
"addODataSelect": true,
"stopResizing": false,
"customParams" "getParameters",
"defaultSpan": {
"rows": 5,
"cols": 1,
"showOnlyHeader": false
}
}
}
getParameters: function(oNavigateParams,oSelectionVariantParams) {
var aCustomSelectionVariant = [];
var aSelectOptions = oSelectionVariantParams.getSelectOptionsPropertyNames();
if(aSelectOptions.indexOf("SupplierName")!=-1) {
var aSupplierFilter = oSelectionVariantParams.getSelectOption("SupplierName");
var sSupplierFilterValue = aSupplierFilter[0].Low;
aSupplierFilter[0].Low = "";
}
var oSupplierName = {
path: "SupplierName",
operator: "EQ",
value1: "",
value2: null,
sign: "I"
};
var oLandFilter = {
path: "Land1",
operator: "EQ",
value1: sSupplierFilterValue,
value2: null,
sign: "I"
};
var oCustomSelectionVariant = {
path: "TaxTarifCode",
operator: "EQ",
value1: 5,
value2: null,
sign: "I"
};
aCustomSelectionVariant.push(oCustomSelectionVariant);
aCustomSelectionVariant.push(oLandFilter);
aCustomSelectionVariant.push(oSupplierName);
return {
selectionVariant: aCustomSelectionVariant,
ignoreEmptyString: true
};
},
onCustomParams: function (sCustomParams) {
if (sCustomParams === "getParameters") {
return this.getParameters;
} else if (sCustomParams === "param2") {
return this.param2;
}
},
/************************* Handler for custom navigation ************************************************
* This function takes the standard navigation entry details (if present) for a particular card and context
* and return a new/modified custom navigation entry to the core. The core will then use the custom
* navigation entry to perform navigation
* @param sCardId : Card id as defined in manifest for a card
* @param oContext : Context of line item that is clicked (empty for header click)
* @param oNavigationEntry : Custom navigation entry to be used for navigation
* @returns {object} : Properties are {type, semanticObject, action, url, label}
* @public
**/
doCustomNavigation: function (sCardId, oContext, oNavigationEntry) {
var oCustomNavigationEntry;
var oEntity = oContext && oContext.sPath && oContext.getProperty && oContext.getProperty(oContext.sPath);
if (sCardId === "card001" && oEntity && oEntity.PurchaseOrder === "4500003575") {
oCustomNavigationEntry = {};
oCustomNavigationEntry.type = "com.sap.vocabularies.UI.v1.DataFieldForIntentBasedNavigation";
oCustomNavigationEntry.semanticObject = "Action";
oCustomNavigationEntry.action = "toappnavsample";
oCustomNavigationEntry.url = ""; //Only required when type is DataFieldWithUrl
oCustomNavigationEntry.label = ""; //Optional
}
return oCustomNavigationEntry;
},
"card9": {
"model": "GWSAMPLE_BASIC",
"template": "sap.ovp.cards.stack",
"settings": {
"title": "{{card9_title}}",
"entitySet": "SalesOrderSet",
"subTitle": "Open orders to approve",
"addODataSelect": false,
"objectStreamCardsSettings": {
"annotationPath": "com.sap.vocabularies.UI.v1.Facets#stack",
"customActions": [{
"text": "action 1",
"press": "press1",
"position": 1
}, {
"text": "action 2 ",
"press": "press1",
"position": 5
} {
"text": "action 3",
"press": "press1",
"position": 10
} {
"text": "action 4",
"press": "press1",
"position": 20
}]
},
"identificationAnnotationPath": "com.sap.vocabularies.UI.v1.Identification#header,com.sap.vocabularies.UI.v1.Identification#card"
}
}
onCustomActionPress: function (sCustomAction) {
if (sCustomAction === "press1") {
return this.press1;
} else if (sCustomAction === "press2") {
return this.press2;
}
},
press1: function(oEvent) {
window.open("https://www.google.co.in");
},
press2: function(oEvent) {
window.open("http://www.sap.com/index.html");
},
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
34 | |
25 | |
12 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |