-
Notifications
You must be signed in to change notification settings - Fork 741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Asynchronous create sub menu's after context menu has opened. #429
Comments
I understand that to get this to work nicely with Angular you would like to use promises like that. To be honest, I only have a small bit of experience with Angular. I can't really predict how much effort it would take to implement. I wouldn't be against a way to do this, but i wonder if it is even possible to do it properly without rewriting tons of code. Anyways I won't be implementing this, but if someone with more experience wants to, it would be fine to talk about how we would do that. |
Hi @bbrala, Thanks for responding. Angular indeed covers this nicely, but is similar to jquery promises which seems to do the same. |
Would be quite awesome if you could find the time to do that! If you have any questions regarding the library, just put it here or send me an email. :) |
Hi @bbrala, I submitted a pull request. There are still some todo's left, which I wonder for what the easiest way is to check if the context menu is open or not (to fix todo no. 2). The other sub-sub-menu promises problem: Not sure where the problem occurs, it does everything correctly on the first time, but once it has been initialized for the first time, it breaks on the second time. See this plunker: https://embed.plnkr.co/6cZo2hCy1a4FRK8GqeT6/ I think best is to throw an error if the user wants to do sub-sub-menu promises? |
Thanks again for the work. I feel like the problemens that arrise on the second open are a scoping issue or perhaps realtive to what menu the promise is called. Every submenu is pretty much a new instance, but then opened with its parent as root. This might be related to your problem. I will have a look later this week to see if I see any glaring problem with the code. And we do need to make sure there are unit tests for this functionality, if you dont feel confortable making those in the qunit framework in place i could have a look. Anyways, i'll start with having a good look later this week. |
I fixed the issue regarding the sub-sub-menu promise. I noticed that it got a class Only 2 things left are avoiding the console error when the context menu is closed while the promise is resolved later and creating unit tests. I agree on creating unit tests, hope you can find the time to do this. I'll update the pull request. |
Hi again, pretty awesome :) I added some comments in the PR. Some todo's to get this up and running:
|
Hi, yes I've updated the code for the refactor and accepting string for errors. The demo is still available on my plunker which you could use to update the documentation. |
Thanks! No not necessarily, just need to remember to do those things before merging. :) |
Well, got it working as it should. Loading icon, proper handle if menu is closed already, and a demo. Couldn't get QUnit to play nice unfortunately. :( |
Merged the changes. Thanks again @Ruud-cb |
Nice! Thanks for merging! |
I had a bad commit day yesterday... wow. Fixed it. |
No problem, no issues now, just that I don't like it that way and still disabled it 😄 |
Hehe fair enough. :) |
Perhaps it is possible to set a boolean to true or false to show and hide that loader. |
Hi,
I've been searching the past 2 days for a perfect context menu, this one and another one stand out above all others. To put it in perspective: I am developing an app with AngularJS. Thus I rather have a angular context menu then a default jquery menu.
One came really close: https://github.com/Templarian/ui.bootstrap.contextMenu
Yet this one was not so nice with providing icons, keyboard events some other things. But it does has one major improvement above this one: Async create sub menu's. Instead of providing an item I can provide an promise, which would be loaded once the user has opened the sub-menu.
Perhaps it would be possible to implement something similar to this? So instead of only providing items, or a list of items, provide a promise, and once it is completed it will render the sub menu's.
I know the documentation provides something with async loading the context menu, but that's not what I am looking for, that happens before everything is created. This should happen once the context menu has already been created, either after the menu has opened, or once the user wants to open the sub menu.
See the plunker for an example using that angular directive: https://embed.plnkr.co/Bebmjn2aAlflxYe1cwIS/
Similar to #421, but then new created sub menu's.
The text was updated successfully, but these errors were encountered: