Skip to content

Instantly share code, notes, and snippets.

@qmacro
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qmacro/297c350acc770cdc7013 to your computer and use it in GitHub Desktop.
Save qmacro/297c350acc770cdc7013 to your computer and use it in GitHub Desktop.
OTT FP in #UI5?
// Get a list of all the aggregated pages in a SplitApp
// ----------------------------------------------------
// oSplitAppControl is a ref to the instantiated SplitApp
// with an XML View in the masterPages aggregation
// and two XML Views in the detailPages aggregation
["getMasterPages", "getDetailPages"]
// Call the relevant functions to get the master & detail page aggregations content
.map(function(fn) {
return oSplitAppControl[fn]();
})
// Flatten the results into a single list
.reduce(function(allpages, pagelist) {
return allpages.concat(pagelist);
})
// Do something with them (here, just show the IDs)
.map(function(oPage) {
return oPage.sId;
})
// => ["__xmlview0--Master", "__xmlview0--Welcome", "__xmlview0--Detail"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment