Dialog methods and options
view codeDialog methods
Method | Effects |
constructor(options={}) | See options list below |
open(event=null, show=true) | Open the dialog
|
close() | Close (hide) the dialog |
show() | Make the dialog visible |
Dialog options
Option | Default value | Notes |
dialog_selector | '#dialog_generic' | The selector for HTML dialog template |
open_event | null | Used to "remember" the event which triggered Dialog opening |
html | '' | Static content to display in dialog body |
url | '' | Optional url to retrieve dialog content via Ajax |
width | null | |
min_width | null | |
max_width | null | |
height | null | |
min_height | null | |
max_height | null | |
button_save_label | 'Save' | |
button_save_initially_hidden | false | Will be shown after form rendering |
button_close_label | 'Cancel' | |
title | '' | |
subtitle | '' | |
footer_text | '' | |
enable_trace | false | show notifications in debug console |
callback | null | a callback to receive events |
autofocus_first_visible_input | true |
Unspecified options will be retrieved from corresponding HTML attributes on the element which fires the dialog opening; for example:
<a href="{% url 'frontend:whatever' object.id %}" data-title="My title" data-subtitle="My Subtitle" onclick="new Dialog().open(event); return false;"> Open </a>
Option | HTML attribute |
url | href |
html | data-html |
width | data-width |
min_width | data-min-width |
max_width | data-max-width |
height | data-height |
min_height | data-min-height |
max_height | data-max-height |
button_save_label | data-button-save-label |
button_close_label | data-button-close-label |
title | data-title |
subtitle | data-subtitle |
footer_text | data-footer-text |