Closed yolttt closed 4 years ago
Hello @yolttt
The best approach to reacting to a item/subitem click is by adding a handler for the ui5-selection-change
event of the ui5-side-navigation
. In the event object, we are providing a reference to the clicked item, so that you can do whatever you wish(open popover, navigate, etc...).
For example:
document.querySelector("ui5-side-navigation").addEventListener("ui5-selection-change", event => {
console.log(event.detail.item);
})
Describe the bug Hello, i'm using ui5-webComponents together with Blazor in order to adhere to standards of SAP. I used a lot of ui5 elements already, but when it comes to
<ui5-side-navigation>
i can't figure out how to set up onclick event properly for sub items of this element. I would like to be able to open dialog/popover e.g.(<ui5-responsive-popover>
) by clicking on some<ui5-side-navigation-sub-item>
of the<ui5-side-navigation-item>
. The only way i was able to achieve this is in Case 3 described below, but the problem is that it only works ifui5-side-navigation-item
is not collapsed.Imports:
Case 1 Not working as expected:
Case 2 Not working as expected:
Case 3 works as expected
Case 3 works... but this is not a good option either, because its impossible to bind event for
<ui5-side-navigation-sub-item>
ofui5-side-navigation-item
if it is collapsed.For this examples i was using just Html, JS and ui5-webcomponents with Parcel server without Blazor to keep it simple.
Not sure if this is a bug or me misunderstanding documentation or doing some mistake... In any case can anyone please help me out here ?