Activities of "matt.fleming"

Cheers for that. I am happy that it is working, and no worries about using leptonx.createContextMenuWithin.

I more was talking about where I ended up having to call it from, the event handler issues, and the change I made to pass document.querySelector('#lpx-toolbar') instead of using the 'notification-bar' id - was just checking whether I had gone the right way with these.

Anyway it is working so I will close. Thanks again for that.

Sorry I didn't reply earlier - took me a while to get back to it and also took me a while to get it working. I did get it working, but had to make a few changes:

  • An event listener was never registered if the script was in _Host.cshtml. It seemed the script was running before the notification component was rendered in the toolbar (note I am using Blazor Server, ABP 8.3.4). So, I created a separate js function and called createContextWithin from there. I called the JavaScript function from OnAfterRenderAsync in the notification component on first render.
  • So far so good, but 2 event listeners were registered which seemed to cancel each other out (OnAfterRenderAsync with firstRender true was being called twice - not sure why). So, I had to add a flag to the JavaScript function which I store in the element's dataset attribute.
  • Lastly, the context menu would not display. I had to change the createContextMenuWithin call to the following to get it to work. Passing the id of the parent lpx-toolbar seemed to be how user context was doing it , and this seems to work.
leptonx.createContextMenuWithin(document.querySelector('#lpx-toolbar'), 'notification-bar');

This all became a little messier than the suggested solution, so if you have a better way to achieve this, or an answer to why it didn't work using your first solution, please let me know.

Thanks!

Showing 1 to 2 of 2 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on September 01, 2025, 08:37