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

access to dialogs collection #109

Closed
ronan-paul opened this issue Jan 13, 2015 · 3 comments
Closed

access to dialogs collection #109

ronan-paul opened this issue Jan 13, 2015 · 3 comments

Comments

@ronan-paul
Copy link

Hello,

I handle several dialogs at the same time and I wish to access to the dialogs collection.
My need are:
1 - define the id of a modal dialog
I found a way to do this with dialogInstance.setId() method
=> Could I introduce a problem here ?
2 - direct access to dialogInstance with a native function
for example: BootstrapDialog.getDialog( id )
=> I miss this feature
3 - browser the dialog collection with a native function
=> I think there is a function returning an array in the source code but I could not find how to call it.

For now, I could find an anwser by using this code:
$.each(BootstrapDialog.dialogs, function(id, dialogInstance)
{
if (dialogInstance.isRealized() && dialogInstance.isOpened() && dialogInstance.getId() == 'WHATEVER I AM LOOKING FOR' )
{
//do something with dialogInstance variable:
my_function( dialogInstance);
}
});

Thank you for your help

@nakupanda
Copy link
Owner

Hi Paul,

For 2), I think it makes sense, will add such a function later.

@waspinator
Copy link

just checking, is there a way to directly access a dialogInstance yet?

nakupanda added a commit that referenced this issue Sep 30, 2015
@nakupanda
Copy link
Owner

I believe you can do it by this way now

/** Assuming you know the dialog's id you are looking for**/
var dialog = BootstrapDialog.getDialog('1234567');
dialog.close();

See changes here 176ce7d#diff-415d7fbb86e89a18afa54b718bbf6345R266

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

No branches or pull requests

3 participants