sap.ui.core.UIComponent: Manifest-based routing target title formatter not working
See original GitHub issueOpenUI5 version:
1.42.7 (latest)
Browser/version (+device/version):
Google Chrome 55.0.2883.87 on Windows 7
Any other tested browsers/devices(OK/FAIL):
Internet Explorer 11 on Windows 7 (FAIL)
URL (minimal example if possible):
With manifest (FAIL): https://formatterbug-p1940442392trial.dispatcher.hanatrial.ondemand.com/manifest/index.html Without manifest (OK): https://formatterbug-p1940442392trial.dispatcher.hanatrial.ondemand.com/component/index.html
Steps to reproduce the problem:
- Simply open the URL and observe the document’s title.
What is the expected result?
The global function someGlobalFunction
(defined in the index.html
file) should be called to format the title and, as a result, the title of the page should be formatted accordingly (it should be ‘TITLE’ - uppercase).
What happens instead?
The global formatter function is not called and the un-formatted string is propagated as the title instead (the title is ‘Title’ - not uppercase).
Any other information? (attach screenshot if possible)
This happens because the manifest entry JSON is passed directly to the constructor of the sap.ui.core.routing.Targets
class, which in turn instantiates the Target, which in turn instantiates the TitleProvider and directly passes the title specification (from the manifest). When building the property or composite binding, the proxy to the formatter function is built by using the name of the function (as passed in the manifest) and not a reference to the function itself.
When using the plain component configuration, the formatter function is called because a function reference is passed instead of the function name (which is not possible inside a JSON file).
There are, IMO, two ways of fixing this:
- Either add a check inside the
_bindProperty
method of theManagedObject
to check if the formatter function is a string or a function. (I would say that this would not be the way to go, as it affects more scenarios; should it be possible to pass a function name when programmatically binding a property?). - Process the manifest entry inside the UIComponent constructor to transform the routing manifest entry and replace all formatter function names with function references. This is the solution I would suggest. If this is confirmed as a bug, I would be happy to contribute a fix.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (5 by maintainers)
I would add another proposal for a fix: prevent interpretation of manifest data as binding configuration.
It is IMHO not intended that anything from the manifest.json is ever interpreted as a UI5 data binding configuration. This only happens because manifest data is propagated to the router 1:1. Maybe, even the router should prevent this when propagating the title.
The manifest.json is meant to be independent from a concrete runtime and using runtime specific binding syntax in it contradicts that idea.
Hi,
the fix for this issue is merged to nightly build already. And will also be included in openui5 version 1.44.7 and 1.42.10.
Best regards, Jiawei