Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Samples/UINamespace-sandboxed/uiNamespace.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,27 @@
Configure extension to proceed.
</div>
</p>
<div class="container" style="border:1px solid #cecece">
<h6>Dialog Style</h6>
<div class="form-check">
<input class="form-check-input" type="radio" name="dialogStyleRadio" id="modalStyle" checked>
<label class="form-check-label" for="modalStyle">
Modal
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="dialogStyleRadio" id="modelessStyle">
<label class="form-check-label" for="modelessStyle">
Modeless
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="dialogStyleRadio" id="windowStyle">
<label class="form-check-label" for="windowStyle">
Window
</label>
</div>
</div>
</div>
</body>
</html>
15 changes: 14 additions & 1 deletion Samples/UINamespace-sandboxed/uiNamespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@
// to be updated if the extension is deployed to a new location.
const popupUrl = 'uiNamespaceDialog.html';

// This checks for the selected dialog style in the radio form.
let dialogStyle;
const dialogStyleOptions = document.getElementsByName('dialogStyleRadio');
if (dialogStyleOptions[0].checked) {
dialogStyle = tableau.DialogStyle.Modal;
}
else if (dialogStyleOptions[1].checked) {
dialogStyle = tableau.DialogStyle.Modeless;
}
else {
dialogStyle = tableau.DialogStyle.Window;
}

/**
* This is the API call that actually displays the popup extension to the user. The
* popup is always a modal dialog. The only required parameter is the URL of the popup,
Expand All @@ -51,7 +64,7 @@
* default interval of refresh.
*/
tableau.extensions.ui
.displayDialogAsync(popupUrl, defaultIntervalInMin, { height: 500, width: 500 })
.displayDialogAsync(popupUrl, defaultIntervalInMin, { height: 500, width: 500, dialogStyle })
.then((closePayload) => {
// The promise is resolved when the dialog has been expectedly closed, meaning that
// the popup extension has called tableau.extensions.ui.closeDialog.
Expand Down
25 changes: 23 additions & 2 deletions Samples/UINamespace/uiNamespace.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>

<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" >
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" ></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" >
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" ></script>

<!-- Extensions Library (this will be hosted on a CDN eventually) -->
<script src="../../lib/tableau.extensions.1.latest.js"></script>
Expand All @@ -29,6 +29,27 @@
Configure extension to proceed.
</div>
</p>
<div class="container" style="border:1px solid #cecece">
<h6>Dialog Style</h6>
<div class="form-check">
<input class="form-check-input" type="radio" name="dialogStyleRadio" id="modalStyle" checked>
<label class="form-check-label" for="modalStyle">
Modal
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="dialogStyleRadio" id="modelessStyle">
<label class="form-check-label" for="modelessStyle">
Modeless
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="dialogStyleRadio" id="windowStyle">
<label class="form-check-label" for="windowStyle">
Window
</label>
</div>
</div>
</div>
</body>
</html>
15 changes: 14 additions & 1 deletion Samples/UINamespace/uiNamespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@
// to be updated if the extension is deployed to a new location.
const popupUrl = `${window.location.origin}/Samples/UINamespace/uiNamespaceDialog.html`;

// This checks for the selected dialog style in the radio form.
let dialogStyle;
const dialogStyleOptions = document.getElementsByName('dialogStyleRadio');
if (dialogStyleOptions[0].checked) {
dialogStyle = tableau.DialogStyle.Modal;
}
else if (dialogStyleOptions[1].checked) {
dialogStyle = tableau.DialogStyle.Modeless;
}
else {
dialogStyle = tableau.DialogStyle.Window;
}

/**
* This is the API call that actually displays the popup extension to the user. The
* popup is always a modal dialog. The only required parameter is the URL of the popup,
Expand All @@ -52,7 +65,7 @@
* default interval of refresh.
*/
tableau.extensions.ui
.displayDialogAsync(popupUrl, defaultIntervalInMin, { height: 500, width: 500 })
.displayDialogAsync(popupUrl, defaultIntervalInMin, { height: 500, width: 500, dialogStyle })
.then((closePayload) => {
// The promise is resolved when the dialog has been expectedly closed, meaning that
// the popup extension has called tableau.extensions.ui.closeDialog.
Expand Down