content.assist.dialog
ContentAssistDialog : d2/sdk/controls/dialogs/content.assist.dialog
Content Assist Dialog. Helps navigating through the repository while selecting an object.
Content assist configuration is to be fetched first to control constructor options. See ContentAssistDialogUtil.
Extends: Object
Example (A typical usage example)
define([
'nuc/lib/underscore',
'd2/sdk/controls/dialogs/content.assist.dialog',
'd2/sdk/models/node.model',
'd2/sdk/utils/contexts/context.utils',
'd2/sdk/utils/contexts/factories/connector',
'd2/sdk/utils/content.assist'
], function(_, NodePicker, NodeModel, contextUtils, ConnectorFactory, contentAssistUtil){
'use strict';
var context = contextUtils.getPerspectiveContext(),
connector = context.getObject(ConnectorFactory),
container = new NodeModel({id: '0c0015fa8000291e'}, {connector: connector});
container.fetch()
.done(function(){
showNodePicker(context, connector, container);
})
.fail(function(){
console.log('failed fetching container');
});
function showNodePicker(context, connector, container) {
contentAssistUtil.getContentAssistOptions({context: context})
.done(function(config){
var title = config ? config.label_value : "",
includeBrowse = (config && config.properties) ? config.properties.has_browse_assist : true,
includeFavorites = (config && config.properties) ? config.properties.has_favorites_assist : false,
globalSearch = (config && config.properties) ? config.properties.has_search_assist : false;
// Enable browsing if nothing is enabled
if (!includeBrowse && !includeFavorites && !globalSearch) {
includeBrowse = true;
}
var nodePicker = new NodePicker({
dialogTitle: title,
startLocations: [],
includeBrowse: includeBrowse,
includeFavorites: includeFavorites,
globalSearch: globalSearch,
context: context,
connector: connector,
initialContainer: container,
selectMultiple: false
});
nodePicker.show()
.done(function(selection){
console.log('Selected ' + selection.nodes.length + ' items.');
})
.fail(function(){
console.log('User cancelled');
});
})
.fail(function(){
console.log('failed to load options for the node picker');
});
}
});
- ContentAssistDialog :
d2/sdk/controls/dialogs/content.assist.dialog
- instance
- .show() ⇒
jQuery.Promise
- .show() ⇒
- inner
- instance
contentAssistDialog.show() ⇒ jQuery.Promise
Shows the dialog
Kind: instance method of ContentAssistDialog
Returns: jQuery.Promise
- resolves & invokes ContentAssistFinishCallback
on positive (select/add) user interaction, rejects otherwise (user cancels).
ContentAssistDialog~ContentAssistDialog
Kind: inner class of ContentAssistDialog
new ContentAssistDialog(options)
Param | Type | Default | Description |
---|---|---|---|
options | object | Construction options holder | |
[options.dialogTitle] | string | Title of the dialog. | |
options.connector | Connector | The connector instance. See ConnectorFactory. | |
options.initialContainer | NodeModel | Begin browsing from this folder/cabinet. The passed object must be fetched before hand. | |
options.context | Context | Active application context. See ContextUtils | |
options.startLocations | Array.<string> | Set the supported content display locations. Supported values are | |
[options.globalSearch] | Boolean | false | Show searchable locations. Short hand for setting |
[options.includeBrowse] | Boolean | true | Show browsable locations from Documentum repository. Short hand for setting |
[options.includeFavorites] | Boolean | false | Show favorited contents. Short hand for setting |
[options.selectMultiple] | Boolean | false | Enable multiple selection. |
[options.selectType] | string | null | Attribute to check while enabling/diabling selectability of a node. |
[options.selectTypeValue] | string | A node is selectable only if its | |
[options.excludeTypes] | Array.<string> | Exclude these node types from display. | |
[options.url_filter] | string | null | An additional fileter query parameter to be used while populating content assist dialog with objects. |
[options.selectButtonLabel] | string | Text to be shown on the affirmative button. |
ContentAssistDialog~ContentAssistFinishCallback : function
Kind: inner typedef of ContentAssistDialog
Param | Type | Description |
---|---|---|
selectedNodes | Object | Selected nodes holder |
selectedNodes.nodes | Array.<NodeModel> | Collection of nodes that were selected. |