sydcanem / bootstrap-contextmenu

Context menu plugin for Twitter's Bootstrap framework
http://sydcanem.com/bootstrap-contextmenu/
644 stars 193 forks source link

hide events not triggered after onItem #70

Closed vkbansal closed 9 years ago

vkbansal commented 10 years ago

When I click on an item, onItem() is called and the menu is hidden. But hide.bs.context and hidden.bs.context are not triggred.

$('#filetree').contextmenu(
    target: "#filetree-contextmenu"
    scopes: "li > a"
    before: (event, element, target)->
        event.preventDefault()
        elem = event.target
        if elem.tagName isnt 'A'
            event.preventDefault()
            @closemenu(event)
            return false    
        true
    onItem: (c,e) -> 
       contextmenu_click(c,e)
).on('hide.bs.context', ->
     alert()
   #Not Triggered
)
sydcanem commented 9 years ago

Events are bound to the menu and not in the context itself. So in you're example it should be

$( '#filetree-contextmenu' ).on( 'hide.bs.context', ->
vkbansal commented 9 years ago

Yes figured it out later on. Thanks for your answer.

-----Original Message----- From: "James Santos" notifications@github.com Sent: ‎25-‎11-‎2014 09:01 To: "sydcanem/bootstrap-contextmenu" bootstrap-contextmenu@noreply.github.com Cc: "Vivek Kumar Bansal" vkb0310@gmail.com Subject: Re: [bootstrap-contextmenu] hide events not triggered after onItem(#70)

Events are bound to the menu and not in the context itself. So in you're example it should be $( '#filetree-contextmenu' ).on( 'hide.bs.context', ->— Reply to this email directly or view it on GitHub.=