This file contains hidden or 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
// String to Number Comparator | |
var oSorter = new sap.ui.model.Sorter("path"); | |
oSorter.fnCompare = function (a, b) { | |
var valA = parseInt(a, 10); | |
var valB = parseInt(b, 10); | |
if (isNaN(valA)) return 1; | |
if (isNaN(valB)) return -1; | |
if (isNaN(valA) && isNaN(valB)) return 0; |
This file contains hidden or 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
// found in https://github.com/SAP/openui5/blob/master/src/sap.ui.core/src/sap/ui/base/DataType.js | |
"any" | |
"boolean" | |
"int" | |
"float" | |
"string" | |
"object" | |
"function" | |
// arrays like this |
This file contains hidden or 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
// always use createKey since for getData/getProperty | |
// "/EntitySet(Prop1='VAL-1',Prop2='VAL-2')" !== "/EntitySet(Prop2='VAL-2',Prop1='VAL-1')" | |
// Be aware that createKey needs ODataModel metadata | |
oModel.metadataLoaded().then(function () { | |
var sKey = oModel.createKey("/EntitySet", { | |
Prop1: "VAL-1", | |
Prop2: "VAL-2" | |
}); | |
}); |
This file contains hidden or 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
constructor: function (sId, mSettings) { | |
// https://github.com/SAP/openui5/blob/master/src/sap.ui.core/src/sap/ui/base/ManagedObject.js#create | |
var oMyAggregation; | |
if ((sId && sId.myAggregation) || (mSettings && mSettings.myAggregation)) { | |
// delete from settings so that applySettings will not pick it up | |
if (sId && sId.myAggregation) { | |
oMyAggregation = sId.myAggregation; | |
delete sId.myAggregation; | |
} | |
if (mSettings && mSettings.myAggregation) { |
This file contains hidden or 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
// boolean defaulting to true | |
bValue = (bValue !== false); | |
bValue = bValue === undefined ? this.getValue() : bValue; | |
sValue = sValue || "default"; |
This file contains hidden or 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
var FnConstructor = jQuery.sap.getObject(sType); |
This file contains hidden or 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
//////////////////////////////// | |
// Controller Lifecycle | |
onInit: function () { | |
this.getRouter().attachRoutePatternMatched(this.onAnyRoutePatternMatched, this); | |
}, | |
onExit: function () { | |
this.getRouter().detachRoutePatternMatched(this.onAnyRoutePatternMatched, this); | |
this.getRouter().getRoute(this.routeName).detachPatternMatched(this.onRoutePatternMatched, this); |
This file contains hidden or 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
/** | |
* @namespace | |
* @name ui5experts.toolbox | |
* @public | |
*/ | |
sap.ui.define([ | |
"sap/ui/base/ManagedObject" | |
], function ( | |
ManagedObject) { |
This file contains hidden or 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
// https://sapui5.hana.ondemand.com/#docs/api/symbols/sap.ui.base.ManagedObject.html#findAggregatedObjects | |
var aResults = oObject.findAggregatedObjects(true, function(o) { return o.getId() === "TEST"; }); |
This file contains hidden or 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
var oBinding = this.byId("Control").getBinding("items"); | |
oBinding.suspend(); | |
// ... | |
oBinding.bPendingRefresh = false; | |
oBinding.resume(); |
OlderNewer