Skip to content
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

MenuOnClose Event? #4

Open
HannibalZA opened this issue May 25, 2016 · 1 comment
Open

MenuOnClose Event? #4

HannibalZA opened this issue May 25, 2016 · 1 comment

Comments

@HannibalZA
Copy link

Would be nice to have an eventHandler to catch when the menu closes.

This helps with some cleanups and more global post-action procedures.

Currently the only option would be to put repetitive code under each action.

Something like so...

        onClose: function($elem) {

            alertify.notify("Done with : " + $elem.text());

        },

By adding:

   /* user-defined function to execute parting methods against opened element...*/

    onClose: _.noop,

And further down
// close the context menu

BootstrapMenu.prototype.close = function() {

    // hide the menu

    if (this.$openTarget) { this.options.onClose(this.$openTarget) };

    this.$menu.hide();

    clearCloseEventListeners(this);

};

This is rough, but I've added it for my own purposes.

@dgoguerra
Copy link
Owner

That's a good idea, I'm happy to accept a PR if you want to give it a try. Otherwise, I'll take a look at it during the following days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants