Skip to main content

open.app.scope.behavior

OpenAppScopeBehavior : d2/sdk/controls/behaviors/open.app.scope.behavior

A Marionette.view behavior to navigate to an application scope perspective. Whichever view uses this behavior, waits for a click event to happen. As a reponse to the click event, it opens the application scope perspective.

A view that has already mixed this behavior, can set a Boolean flag disableAppScopeBehavior=true to disbale the behavior.

Extends: Marionette.Behavior
Example (To use this behavior in a sample view)


define([
'nuc/lib/marionette',
'd2/sdk/controls/behaviors/open.app.scope.behavior',
'd2/sdk/utils/contexts/context.utils'
], function(Marionette, OpenAppScopeBehavior, contextUtil){
'use strict';

var context = contextUtil.getPerspectiveContext();

var MyView = Marionette.LayoutView.extend({
behaviors: {
AppScope: {
behaviorClass: OpenAppScopeBehavior,
context: context,
applicationScope: 'favorites'
}
},
template: false,
onRender: function() {
this.$el.text('Click me to open favorites');
}
});
});

OpenAppScopeBehavior~OpenAppScopeBehavior

Kind: inner class of OpenAppScopeBehavior

new OpenAppScopeBehavior(options, view)

ParamTypeDescription
optionsobject

Constructor options, automatically passed by Marionette from behavior configuration of a view

options.applicationScopestring

Name of the application scope to be opened on click.

options.contextContext

Reference to the runtime context. See Context.

[options.registerClickEventListener]Boolean

Whether the view should add a separate click event listener. Defaults to true. Some views which has already added a click event listener on self element for some purpose, can be reused automatically for this behavior, in that case this flag needs to be set to false explicitly.

viewMarionette.View

The view instance associated with this behavior instance. Automatically set by Marionette.