shortcut.tile.behavior
ShortcutTileBehavior : d2/sdk/widgets/shortcut.tile/shortcut.tile.behavior
Interface for all classes that want to implement a shortcut tile's behavior. Defines what should happen when user clicks on a particular shortcut tile in D2 Smart View landing perspective and also lets customize appearance of the shortcut tile upto some extent.
Extends: Marionette.Behavior
Example (A new shortcut behavior url.shortcut.behavior.js could be defined as)
define([
'd2/sdk/widgets/shortcut.tile/shortcut.tile.behavior',
'd2/sdk/utils/utils'
], function(BaseShortcutBehavior, utils){
'use strict';
var URLShortcutBehavior = BaseShortcutBehavior.extend({
onClick: function() {
if(this.options.data.url) {
utils.openUrlInWindow(this.options.data.url, window.open(''));
}
}
});
return URLShortcutBehavior;
});
Example (to register this shortcut behavior with ShortcutTileBehaviorCollection, add in extension.json)
{
"d2/sdk/widgets/shortcut.tile/shortcut.tile.behaviors": {
"extensions": {
"mybundle": {
"mybundle/extensions/my.shortcut.behaviors"
}
}
}
}
Example (where my.shortcut.behaviors.js is defined as)
define([
'mybundle/widgets/shortcut.tile/url.shortcut.behavior'
], function(URLShortcutBehavior){
'use strict';
// see 'ShortcutBehaviorType' documentation below for all possible properties and their usage.
return [
{type: 'OpenURLWidget', behaviorClass: URLShortcutBehavior}
// Additional behaviors can also be registered
];
});
- ShortcutTileBehavior :
d2/sdk/widgets/shortcut.tile/shortcut.tile.behavior
- instance
- .view :
Marionette.View
- .viewModel :
Backbone.Model
- .context :
Context
- .options :
Object
- .onRender()
- .onClick()
- .view :
- static
- .extend(protoProperties, staticProperties) ⇒
function
- .extend(protoProperties, staticProperties) ⇒
- inner
- ~ShortcutBehaviorType :
Object
- ~ShortcutBehaviorType :
- instance
shortcutTileBehavior.view : Marionette.View
reference to the shortcut's presentation
Kind: instance property of ShortcutTileBehavior
shortcutTileBehavior.viewModel : Backbone.Model
the model controlling the shortcut view
Kind: instance property of ShortcutTileBehavior
shortcutTileBehavior.context : Context
active application context
Kind: instance property of ShortcutTileBehavior
See: Context
shortcutTileBehavior.options : Object
Holder of parameters passed during shortcut construction. Has a normalized referece to the D2 Smart View landing page configuration behind this shortcut tile.
Kind: instance property of ShortcutTileBehavior
shortcutTileBehavior.onRender()
Marionette view lifecycle hook. It can be overriden to make any changes to the DOM element of the underlying shortcut view.
If overriden, it should call the onRender
method of super type as the first thing. See example above.
Kind: instance abstract method of ShortcutTileBehavior
shortcutTileBehavior.onClick()
Business logic to define what happens on click. It can be overriden to provide custom logic.
Kind: instance abstract method of ShortcutTileBehavior
ShortcutTileBehavior.extend(protoProperties, staticProperties) ⇒ function
To define a derived type from ShortcutTileBehavior
.
Kind: static method of ShortcutTileBehavior
Returns: function
- The derived type.
Param | Type | Description |
---|---|---|
protoProperties | object | Properties attached to the prototype of derived type. |
protoProperties.constructor | function | The function to be used to construct instance of the derived type. |
staticProperties | object | Properties statically attached to the derived type. |
ShortcutTileBehavior~ShortcutBehaviorType : Object
Extension definition to link a shortcut behavior implementation with a shortcut tile type.
Kind: inner typedef of ShortcutTileBehavior
Properties
Name | Type | Default | Description |
---|---|---|---|
type | string | Type of the shortcut tile. | |
behaviorClass | ShortcutTileBehavior | The behavior implementation. | |
[sequence] | number | 1000 | Priority of this behavior for the given |