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

Improve readme #7

Open
gucki opened this issue Aug 15, 2012 · 2 comments
Open

Improve readme #7

gucki opened this issue Aug 15, 2012 · 2 comments

Comments

@gucki
Copy link

gucki commented Aug 15, 2012

It should probably pointed out in the readme that you cannot bind on the shown and hidden event directly on the modal but one must use modal.$el instead:

Does not work

modal.on('shown', function() {
  // some code
});

Works

modal.$el.on('shown', function() {
  // some code
});
@powmedia
Copy link
Owner

The events are proxied through the modal so it should work. However there is another bug (#4) related to pressing Esc to close the modal which doesn't trigger this, which may be where you're running into the problem.

@gucki
Copy link
Author

gucki commented Aug 15, 2012

I tried using it without the $el and it does not work for me. Probably the proxy is broken?

Failing code:

view = new MyApp.Views.SomeEdit(model: @model)
modal = new Backbone.BootstrapModal(content: view)
modal.on 'shown', -> alert('test')
modal.on 'ok', => modal.preventClose() unless view.save()
modal.open()

Working code:

view = new MyApp.Views.SomeEdit(model: @model)
modal = new Backbone.BootstrapModal(content: view)
modal.$el.on 'shown', -> alert('test')
modal.on 'ok', => modal.preventClose() unless view.save()
modal.open()

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