Closed gwinnem closed 7 years ago
Yup, you just need to trigger the jQuery event "mousedown" on $(document.body)
If you look at the code, you'll see there's a listener to this event. This will trigger all other mousedown events though. There's no direct way to close the contextmenu that's exposed currently. If you really need this, let me know.
I am triggering the below code: But context menu is still open until i click the modal, but i need it to close automatically $(document.body).trigger("mousedown"); var kendoTree = this.tree; var dataItem = this.tree.dataItem(this.tree.select()); $scope.dataItem = kendoTree.dataItem(kendoTree.select()); var modalDefaults = { controller: "FolderAddController" }; var modalOptions = { kendoTree: kendoTree, dataItem: dataItem, headerText: $scope.translation.AddFolder, actionButtonText: $scope.translation.Save, contentUrl: "Scripts/app/FileManager/Templates/folder-add-form.html" }; $scope.openDialog(modalDefaults, modalOptions);
What version of the context-menu are you using? If it's an old one this might work instead:
$(".angular-bootstrap-contextmenu").mousedown()
or
$(".angular-bootstrap-contextmenu").trigger("mousedown")
It's because the binding for the close was different before.
I am using the code from github but i still have the same issue.
On 9 May 2017 at 12:38, Jose Taira notifications@github.com wrote:
What version of the context-menu are you using? If it's an old one this might work instead:
$(".angular-bootstrap-contextmenu").mousedown()
It's because the binding for the close was different before.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Templarian/ui.bootstrap.contextMenu/issues/106#issuecomment-300126417, or mute the thread https://github.com/notifications/unsubscribe-auth/AGIR8Pdlo79pq9xwAZqkt_64i54COrGSks5r4EIagaJpZM4NU_wY .
Found a fix by adding $("ul").remove(".dropdown-menu"); to the code in the menu items to enforce that the menu is removed before i open my modal box.
Is it possible to close the context menu in javascript ?