Skip to main content

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.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)

ParamTypeDefaultDescription
optionsobject

Construction options holder

[options.dialogTitle]string

Title of the dialog.

options.connectorConnector

The connector instance. See ConnectorFactory.

options.initialContainerNodeModel

Begin browsing from this folder/cabinet. The passed object must be fetched before hand.

options.contextContext

Active application context. See ContextUtils

options.startLocationsArray.<string>

Set the supported content display locations. Supported values are 'search.location', 'current.location', 'favorites'. At least an empty array must be passed if following shorthand flags globalSearch, includeBrowse, includeFavorites` are used to control the start locations.

[options.globalSearch]Booleanfalse

Show searchable locations. Short hand for setting search.location as part of startLocations.

[options.includeBrowse]Booleantrue

Show browsable locations from Documentum repository. Short hand for setting current.location as part of startLocations.

[options.includeFavorites]Booleanfalse

Show favorited contents. Short hand for setting favorites as part of startLocations.

[options.selectMultiple]Booleanfalse

Enable multiple selection.

[options.selectType]stringnull

Attribute to check while enabling/diabling selectability of a node. 'typeName' could be used as a value.

[options.selectTypeValue]string

A node is selectable only if its selectType attribute's value mathes with this value.

[options.excludeTypes]Array.<string>

Exclude these node types from display.

[options.url_filter]stringnull

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

ParamTypeDescription
selectedNodesObject

Selected nodes holder

selectedNodes.nodesArray.<NodeModel>

Collection of nodes that were selected.