simple.dialog
SimpleDialog : d2/sdk/controls/dialogs/simple.dialog
Create a simple modal dialog. Has customizable header, footer and primary content.
Extends: Marionette.View
Emits: event:"shown.binf.modal"
, event:"hidden.binf.modal"
Example
define([
'd2/sdk/controls/dialogs/simple.dialog'
], function(SimpleDialog){
'use strict';
var dialog = new SimpleDialog({title: 'Greetings', bodyMessage: 'Hello World!'});
dialog.show(); //Dialog is rendered with a close button at top-right corner of the header.
dialog = new SimpleDialog({title: 'Greetings', bodyMessage: 'Hello World!', buttons: [{label: 'OK'}]});
dialog.show();//Dialog header does not show a close button anymore, however SimpleDialog automatically adds a 'Cancel' button to close it.
});
- SimpleDialog :
d2/sdk/controls/dialogs/simple.dialog
- instance
- inner
- ~SimpleDialog
- ~FooterButton :
Object
- ~FooterButtonClickCallback :
function
simpleDialog.show() ⇒ any
Shows the dialog after it has been instantiated
Kind: instance method of SimpleDialog
Returns: any
- The dialog instance
simpleDialog.updateButton(id, [attributes]) ⇒ void
Updates the dialog's footer button state.
Kind: instance method of SimpleDialog
Param | Type | Description |
---|---|---|
id | string | Identifier of the button to be updated. |
[attributes] | object | New button state properties |
[attributes.hidden] | Boolean | Whether is button is to be hidden. |
[attributes.disabled] | Boolean | Whether this button should be disabled. |
simpleDialog.destroy() ⇒ void
Hide & close the dialog
Kind: instance method of SimpleDialog
"event:shown.binf.modal"
Triggers on the dialog's HTML element when it is shown.
Kind: event emitted by SimpleDialog
"event:hidden.binf.modal"
Trigger on the dialog's HTML element when it becomes hidden.
Kind: event emitted by SimpleDialog
SimpleDialog~SimpleDialog
Kind: inner class of SimpleDialog
new SimpleDialog(options)
Param | Type | Description |
---|---|---|
options | object | Constructor options |
options.title | string | Title of the dialog. |
[options.fullSize] | Boolean | Whether to show a full page dialog. |
[options.largeSize] | Boolean | Shows a large dialog. |
[options.midSize] | Boolean | Shows a medium dialog. |
[options.smallSize] | Boolean | Shows a small dialog. |
[options.bodyMessage] | string | A message to be shown at the primary content area. |
[options.buttons] | Array.<FooterButton> | Buttons to show in the footer if footer is not customized with |
[options.view] | Marionette.View | Customize the primary content area with this view instance. |
[options.headerView] | Marionette.View | Customize the dialog's header completely with this view instance. |
[options.footerView] | Marionette.View | Customize the dialog's footer completely with this view instance. |
SimpleDialog~FooterButton : Object
Kind: inner typedef of SimpleDialog
Properties
Name | Type | Description |
---|---|---|
label | string | Text to be displayed on the button |
[toolTip] | string | Tooltip associated with the button. |
[id] | string | Unique identifier of this button. |
[default] | Boolean | Whether this button is default button in the footer. Default button is drawn with a visual distinction compared to other buttons. |
[separate] | Boolean | Whether this button is to be drawn separately. |
[click] | FooterButtonClickCallback | Callback to handle click event from the button. |
[close] | Boolean | Whether this button closes the dialog. |
[hidden] | Boolean | Whether this button should be hidden |
[disabled] | Boolean | Renders a button in disabled state. |
SimpleDialog~FooterButtonClickCallback : function
Kind: inner typedef of SimpleDialog
Param | Type | Description |
---|---|---|
options | object | |
dialog | * | The dialog itself. |
button | HTMLElement | DOM element of the button that is clicked. |
buttonAttributes | Object | Attributes of the button. |