This component uses hierarchies from BW. It could be adapted to connect to Hana or a Universe, but these hierarchies have not been tested.
The component has been tested, but you may encounter some bugs. For either bugs or enhancement request, do not hesitate to post an "issue" on our GitHub.
If you have read the SCN forum the past year or are interested in SDK extensions, you have probably noticed the SDK Community package initiative, and maybe also a "Multi level Dropdown Menu" article.
This extension has been renamed "Hierarchical menu" and it renders a BW hierarchy into a dropdown menu (similar to one on websites).
This new version includes several bug fixes, and new features that are explained below.
The most common way of drilling down in a hierarchy with Design studio is to use a dimension filter pane, as shown below:
With this article, I propose to use a convenient way to explore a hierarchy, through cascading dropdown menus, similar to a hierarchical structure:
A preview can be found here:
For the end user, it is an easier way to navigate through the hierarchy without losing context.
This dropdown menu has been developed using jQuery, HTML Unordered lists (UL / LI) and CSS to handle the display.
The CSS has been adapted from Simple Pure CSS Drop Down Menu.
You can find the SDK Community package here and the code of the extension here.
You can also import this DS application (made with 1.5 SP02) to test the component. You will only need to configure the 2 datasources:
UPDATE: this component has been improved again for version 1.6. You can find the blog here.
By default, all the first nodes of the hierarchy will be displayed:
Mode | Effect |
---|---|
Without single Node | |
With Single node |
By changing these parameters, you can add a single root node, and select its name:
Also, the event "On Reset" (Script) will be triggered if you click on the newly created Single Root Node.
Methods:
You can add a Reset button (X) at the left or right of the root nodes to cancel the selection.
The event "On Reset" (Script) will be triggered. Please note that selections on the menu will be removed, even if you have not attached any script. Note that if you have a single root node, clicking on it will have exactly the same effect.
Methods:
When you click on an item in the menu, the node key will be retrieved and the OnClick event will be triggered.
You can call the method .getSelectedElemKey() on the component to retrieve the selected key. The method .getSelectedElemText() will give you the text instead. For example:
Some classes will be applied on the html menu on the selection nodes, and its parents:
Methods:
You can choose from 3 options:
To understand this setting, you should be aquainted with how the data from BW.
For instance, each node has three attributes:
Pratical Example:
I chose Text+Key label display on the Partner in the query. In DS, both key and text are concatenated as "SAP|1/10000000".
Here, the Text is the Left part and the Key the Right Part.
Depending on the requirement, choose between the 3 available values. Let me know If I can make it more user friendly (maybe with a formatting function ?).
You can access the selected Key and Text with methods .getSelectedKey and .getSelectedText.
This is not the best way to handle the display. It would require some enhancements (1. get the display mode from the char 2. give you the choice to display text or key, but I really doubt SAP will give us this information in a near future).
Methods:
One of the new addition is the possibility to display a mesure along the node:
This key figure / measure must be present in the binded query and can be selected either by a script or at the design time in the APS.
Methods:
If you use a measure, you can dynamically apply CSS classes to each node depending on its value.
Provide a JSON Table with the class to use:
CSS | |
Result: |
The Json table must have the following structure, and can have as many cssClass iterations. The value of cssClass will be applied dynamically to the node menu LI item.
LOW represent the first bound and HIGH the second bound. Both are considered with a superior/lower or equal to its value.
[
{"cssClass":"DD_RED", "low":"0", "high":"10"},
{"cssClass":"DD_YEL", "low":"10", "high":"40"},
{"cssClass":"DD_GREEN","low":"40", "high":"100"}
]
The measure needs to be displayed to make it work, but you could easily hide it with CSS if necessary.
Methods:
If you allowed your hierarchy to display the not assigned with the option uncheck below, you'll have a generated text which is pretty unappealing:
=
If you want to change the text, you can use one of the extension feature in the APS, or change it dynamically with the method. It will replace "Not Assigned XXX" by the value:
Methods:
As explained before, the list will be rendered as a pain UL / LI HTML list and you'll need to apply a CSS stylesheet. Many display options can be chosen, and you can find a lot of inspiration on internet (some website propose prebuild CSS stylesheets).
Until now, all of the screenshots of this article were based on the provided CSS below.
Download the CSS file, and import it into DS application as Custom CSS (on the Application element). If you already have one, copy/paste the content into your CSS file. It should not break anything as all the classes are prefixed by scn-hier-ddm-.
Name | Preview | CSS file |
---|---|---|
Classic Hierarchical dropdown menu | Download |
I will add more in the future, and do not hesitate to share yours in the comments if you want. I will post them as well :smile:
The menu is composed of the elements below. The ones in brackets are optional. Each List (UL) must have one node (LI) and the leaves cannot have other Lists (UL) underneath.
Each HTML elements is associated with some CSS classes to ease the work of the developer. The table below contains all of them with some explanations.
HTML Elements | Associated CSS Classes | Description |
---|---|---|
NAV | .scn-hier-ddm-disp-has-mesure | Applied to the primary container if the menu displays measures. This class and the one below are exclusive. |
NAV | .scn-hier-ddm-disp-no-mesure | If you do not display a measure, this class will be applied instead, meaning the measure have not been generated. It is "important" to distinguish these 2 states if you want, for example, to display an arrow at the right of the nodes |
UL | .scn-hier-ddm-root-list | Corresponds to the first list. Basically, only the first UL has it. |
UL | .scn-hier-ddm-list | Corresponds to underneath lists, inside a node |
LI | .scn-hier-ddm-root-node | Applied to each items in the root list (if you want to have a slightly different display from the actual nodes) |
LI | .scn-hier-ddm-node | Applied to each items underneath, basically to the nodes of the hierarchy |
LI | .scn-hier-ddm-has-sub | Applied to nodes of the hierarchy containing children. If an item do not have this class, it's a leaf instead |
LI | .scn-hier-ddm-sel-parents | Applied to the parents of the selected node |
LI | .scn-hier-ddm-sel-node | Applied to the selected node |
LI | .scn-hier-ddm-reset-button | Applied to the reset button, if used |
Span | .scn-hier-ddm-text | Corresponds to the displayed text of the node |
Span | .scn-hier-ddm-mesure | If you display a mesure, the generated span will have this class |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
12 | |
7 | |
5 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |