Skip to main content

Pentaho+ documentation has moved!

The new product documentation portal is here. Check it out now at docs.hitachivantara.com

 

Hitachi Vantara Lumada and Pentaho Documentation

AddIn

cdf. AddIn

Creates a new add-in. Add-ins come in two varieties: Static add-ins represent static data or behavior, while Scriptable add-ins represent dynamic, context-dependent behavior.

AMD Module

require(["cdf/AddIn"], function(AddIn) { /* code goes here */ });

Constructor

Name Description
new AddIn(options)

Class that allows creating Static or Scriptable add-ins.

Methods

Name Description
call(target, state, options) : Object | Object

Executes the add-in _implementation function or returns the value of _value.

getLabel() : string

Returns the add-in label.

getName() : string

Returns the add-in name.

setDefaults(defaults)

Sets the default values of the configurable settings.

Constructor Details

new AddIn(options)

The constructor of an add-in.

Source: AddIn.js, line 20

Parameters:
Name Default Value Summary
options : Object

The options for the add-in. Needs a label, a name property, and either a value (for static add-ins) or an implementation member (for scriptable add-ins). If the add-in supports configuration, it should be provided via the options.defaults property.

Parameters:
Name Default Value Summary
label : string

The human-readable label of the add-in.

name : string

The name of the add-in used as an internal identifier.

implementation : function
Optional

The implementation function of the add-in.

value : Object
Optional

The value of the add-in.

defaults : Object
Optional

The default values of the configurable settings.

Throws:
Name Description
TypeError

If the options parameter is not an object.

TypeError

If options.name or options.label are not provided. Also, either options.implementation or options.value needs to be defined.

Methods Details

call(target, state, options) : Object | Object

Call the add-in. If the add-in is static, all parameters are irrelevant, and this method will simply return the value of _value.

In a dynamic add-in, the implementation will be passed to the target DOM Element (whatever element is relevant, e.g. the element that was clicked on or the table cell that is being processed), a state object with whatever context is relevant for the add-in to fulfill its purpose, and optionally any overriding options.

Components are allowed to pass undefined as the target if no elements make sense in context.

Source: AddIn.js, line 153

Parameters:
Name Default Value Summary
target : jQuery

The relevant DOM element.

state : Object

A representation of the necessary context for the add-in to operate.

options : Object

Configuration options for the add-in.

Returns:
Name Description
Object

The value of _value if the _implementation function is undefined.

Object

The result of executing the _implementation function when it is available.

getLabel() : string

Returns the add-in label.

Source: AddIn.js, line 114

Returns:
Name Description
string

The add-in label.

getName() : string

Returns the add-in name.

Source: AddIn.js, line 124

Returns:
Name Description
string

The add-in name.

setDefaults(defaults)

Sets the default values of the configurable settings. If defaults is a function it will override any previous default values. If it is an object its properties will be used to extend the current default values.

Source: AddIn.js, line 176

Parameters:
Name Default Value Summary
defaults : Object

The default values for the configurable settings.