Last active
March 15, 2017 12:05
-
-
Save ricma/f5a32e210268e433c69d to your computer and use it in GitHub Desktop.
Sapui5 NavigationBar ToolTip Issue http://scn.sap.com/thread/3594866
This file contains 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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> | |
<script src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js" | |
id="sap-ui-bootstrap" | |
data-sap-ui-libs="sap.ui.commons,sap.suite.ui.commons" | |
data-sap-ui-theme="sap_bluecrystal" | |
type="text/javascript"> | |
</script> | |
<script type="text/javascript"> | |
// set up a tree structure | |
var oModel = new sap.ui.model.json.JSONModel(); | |
oModel.setData({ | |
things: [ | |
{ name: "1", | |
things: [ | |
{ name: "11", | |
things: [ { name: "111", things: [] }, | |
{ name: "112", things: [] } ] }, | |
{ name: "12", | |
things: [ { name: "121", things: [] }, | |
{ name: "122", things: [] } ] }, | |
{ name: "13", | |
things: [] } ] }, | |
{ name: "2", | |
things: [ | |
{ name: "21", | |
things: [ { name: "211", things: [] }, | |
{ name: "212", things: [] }, | |
{ name: "213", things: [] } ] }, | |
{ name: "22", | |
things: [ { name: "221", things: [] } ] }, | |
{ name: "23", | |
things: [ { name: "221", things: [] } ] } | |
] } ]}); | |
// Allow to click on an element to ascend up into the tree | |
var oNavBarTemplate = new sap.suite.ui.commons.CountingNavigationItem({ | |
key: "{name}", text: "{name}", tooltip: "Hmmm ..."}); | |
var oNavBar = new sap.suite.ui.commons.VerticalNavigationBar(). | |
bindAggregation("items", { | |
path: "things", | |
template: oNavBarTemplate}). | |
attachSelect(function(oSelectEvent) { | |
// FIXME: Clicking yields | |
// TypeError: i.getTooltip(...) is null | |
var sPath = oSelectEvent.getParameter("item"). | |
getBindingContext().getPath(); | |
oSelectEvent.getSource().bindElement(sPath); | |
}). | |
bindElement("/"). | |
setModel(oModel). | |
placeAt("content"); | |
// FIXME: This is a bit hacky ... | |
// override the default to avoid error messages popping up in | |
// the debugger after clicking to navigate | |
oNavBar._hideTooltip = function() { }; | |
oNavBar._showTooltip = function() { }; | |
</script> | |
</head> | |
<body class="sapUiBody"> | |
<div id="content"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment