Due to a ransomware attack, the wiki was reverted to a July 2022 version. . We apologize for the lack of a more recent valid backup.
...
Example Usage | Arguments | Return Value |
---|---|---|
dialog.setTitle(title); | title - the text to set as the title | dialog API |
dialog.addContent(content); | content - a D3 selection to be appended to the content section of the dialog | dialog API |
| cb - the callback function to be invoked when the button is pressed text - the text to display on the button cbkey - the callback function to be invoked when the button is pressedkeyboard key chained - add button to key event chain | dialog API |
The following dialog box might have code structured as listed below:
...
Code Block | ||||
---|---|---|---|---|
| ||||
// ds is a reference to the DialogService. var dialogId = 'app-dialog', dialogOpts = { edge: 'right' }; function createConfirmationText(action, itemId) { var content = ds.createDiv(); content.append('p').text(action + ' ' + itemId); return content; } function confirmAction(action) { var itemId = $scope.selId, spar = $scope.sortParams; function dOk() { $log.debug('Initiating', action, 'of', itemId); wss.sendEvent(appMgmtReq, { action: action, name: itemId, sortCol: spar.sortCol, sortDir: spar.sortDir }); } function dCancel() { $log.debug('Canceling', action, 'of', itemId); } ds.openDialog(dialogId, dialogOpts) .setTitle('Confirm Action') .addContent(createConfirmationText(action, itemId)) .addButton(dOk, 'OK', dOk) .addButton(dCancel, 'Cancel', dCancel); } // e.g. confirmAction('activate'); // $scope.selId contains the ID of the selected item |
...
Also note, since addButton()
takes just a function reference as its second first argument, any data required for the function should be defined in the closure.
...