-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
basic docs and demo for messagebox widget
- Loading branch information
Showing
3 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
define({ | ||
isDebug: true, | ||
|
||
mapOptions: { | ||
basemap: 'streets', | ||
center: [-96.59179687497497, 39.09596293629694], | ||
zoom: 5, | ||
sliderStyle: 'small' | ||
}, | ||
|
||
titles: { | ||
header: 'CMV MessageBox Widget', | ||
subHeader: 'This is an example of Confirm and Alert MessageBoxes', | ||
pageTitle: 'CMV MessageBox Widget' | ||
}, | ||
|
||
panes: { | ||
left: { | ||
collapsible: false, | ||
style: 'display:none' | ||
} | ||
}, | ||
|
||
operationalLayers: [], | ||
|
||
widgets: { | ||
|
||
// widget to create the MessageBox | ||
messagebox: { | ||
include: true, | ||
id: 'messagebox', | ||
type: 'invisible', | ||
path: 'widgets/MessageBox', | ||
options: { | ||
nameSpace: 'app' // optional namespace | ||
} | ||
}, | ||
|
||
// simple widget to show how to open | ||
// and respond to a message box | ||
callMeAMessageBox: { | ||
include: true, | ||
id: 'callMeAMessageBox', | ||
type: 'invisible', | ||
path: 'dijit/_WidgetBase', | ||
options: { | ||
map: true, | ||
startup: function () { | ||
// waiting a second. not normally needed when used in your code | ||
window.setTimeout(function () { | ||
|
||
// use the same namespace defined in the messagebox options above | ||
// can be called from anywhere in your code | ||
var mb = window.app.MessageBox; | ||
mb.confirm({ | ||
title: 'Delete Feature?', | ||
content: 'Are you sure you want to delete this feature?<br/><br/>This action cannot be undone.' | ||
}).then( | ||
function (result) { | ||
// respond based on the results returned from the confirm MessageBox | ||
if (result === mb.okMessage) { | ||
mb.alert({ | ||
title: 'Feature Deleted', | ||
content: 'You chose to delete the feature.' | ||
}); | ||
} else if (result === mb.cancelMessage) { | ||
mb.alert({ | ||
title: 'NOT Deleted', | ||
content: 'You chose NOT to delete the feature.' | ||
}); | ||
} | ||
}, | ||
function (/* result */) {} | ||
); | ||
}, 1000); | ||
} | ||
} | ||
} | ||
} | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#Message Box for CMV | ||
Show a modal Confirmation or Alert dialog box. Intended to be called from other widgets. | ||
|
||
--- | ||
## Configurable Options | ||
|
||
| Parameter | Type | Description | | ||
| :----: | :--: | ----------- | | ||
| `nameSpace` | String | Default is null Optional Namespace. If omitted, the global window Namespace is used. | | ||
| `okMessage` | String | Default is 'MessageBox.OK'. | | ||
| `cancelMessage` | String | Default is 'MessageBox.Cancel'. | | ||
|
||
|
||
--- | ||
## Example Configuration: | ||
``` javascript | ||
messagebox: { | ||
include: true, | ||
id: 'messagebox', | ||
type: 'invisible', | ||
path: 'widgets/MessageBox', | ||
options: { | ||
nameSpace: 'app' // optional namespace | ||
} | ||
} | ||
``` | ||
## Screenshot: | ||
![Screenshot](https://tmcgee.github.io/cmv-widgets/images/messagebox1.jpg) | ||
|