Skip to main content
Pentaho Documentation

Select

pentaho.visual.action.Select

The Select action is a synchronous action that is performed when the user interacts with a visual element, typically by clicking on it. This action has the alias "select", which can also be specified as the event name when calling on of action targets.

See also the default action performed by this action type, _doDefault.

AMD Module

require(["pentaho/visual/action/select"], function(Select) { /* code goes here */ });

See also:  pentaho.visual.action.spec.ISelect , pentaho.visual.action.spec.ISelectProto , pentaho.visual.action.spec.ISelectTypeProto

Extends

Constructor

Name Description
new Select(spec)

Creates a data action instance given its specification.

Classes

Name Summary
Type

The type class of selection actions.

Members

Name Description
$isValid : boolean

Determines if this value is a valid instance of its type.

$key : string

Gets the key of the value.

$type : pentaho.type.Value.Type

Gets the type of this instance.

_executor : pentaho.type.action.IObserver
 
Protected

Gets the executor to which the actual action execution is delegated.

dataFilter : pentaho.data.filter.Abstract

Gets or sets the data filter of this action.

description : __nonEmptyString

Gets or sets the description of this action.

error : Error | pentaho.lang.UserError

Gets the reason for a rejected action execution, or null.

isCanceled : boolean

Gets a value that indicates if the action has been canceled.

isCandidate : boolean

Gets a value that indicates if the action is in a candidate state.

isDone : boolean

Gets a value that indicates if the action executed successfully.

isEditable : boolean

Gets a value that indicates if the action is editable.

isExecuting : boolean

Gets a value that indicates if the action is executing.

isFailed : boolean

Gets a value that indicates if the action has failed.

isFinished : boolean

Gets a value that indicates if the action has finished execution.

isRejected : boolean

Gets a value that indicates if the action has been rejected.

label : __nonEmptyString

Gets or sets the label of this action.

position : pentaho.visual.spec.IPoint

Gets or sets the position where the action took place, in screen coordinates.

promise : Promise

Gets a promise for the result (or error) of this action's execution, if ever.

result : any

Gets the result of a successful action execution, if any.

selectionMode : pentaho.visual.action.SelectionMode

Gets or sets the selection mode of this action.

state : pentaho.type.action.States

Gets the current action state.

target : pentaho.visual.base.View

Gets the target view where the action is executing or has executed.

Methods

Name Description
_assertEditable()
 
Protected

Asserts that the action is editable and throws an error if not.

_configure(config)
 
Protected

Configures this value with a given non-nully configuration.

_doDefault() : Promise

Applies the action's selectionMode function to the target view's selectionFilter and the action's dataFilter.

_onPhaseDo() : Promise
 
Protected

Called during the action's do phase.

_onPhaseFinally()
 
Protected

Called during the action's finally phase.

_onPhaseInit()
 
Protected

Called during the action's initialize phase.

_onPhaseWill()
 
Protected

Called during the action's will phase.

_setTarget(target)
 
Protected

Called to validate and set the action's target, upon execution.

assertValid()

Ensures that the value is valid, and throws the first validation error if it is not.

clone() : pentaho.type.Value

Creates a shallow clone of this value.

configure(config) : pentaho.type.Value

Configures this value with a given configuration.

done(result) : pentaho.type.action.Base

Called from an action observer to mark the action as being done, optionally given a result value.

equals(other) : boolean

Determines if a given value, of the same type, represents the same entity.

execute(target, executor) : pentaho.type.action.Base

Executes the action on a given target and, optionally, with a given executor, and does not wait for its outcome.

executeAsync(target, executor) : Promise

Executes the action on a given target and, optionally, with a given executor, and waits for its outcome.

reject(reason) : pentaho.type.action.Base

Called from an action observer to mark the action as rejected.

toJSON() : UJsonValue

Creates a top-level JSON specification that describes this instance.

toSpec(keyArgs) : pentaho.type.spec.UInstance

Creates a specification that describes this value.

toSpecInContext(keyArgs) : any

Creates a specification that describes this instance.

validate() : Array.<pentaho.type.ValidationError>

Determines if this value is a valid instance of its type.

Constructor Details

new Select(spec)

Creates a data action instance given its specification.

Source: javascript/web/pentaho/visual/action/select.js, line 121

Parameters:
Name Default Value Summary
spec : pentaho.visual.action.spec.ISelect
 
Optional

A selection action specification.

See also:  pentaho.visual.action.spec.ISelect , pentaho.visual.action.spec.ISelectProto , pentaho.visual.action.spec.ISelectTypeProto

Members Details

$isValid: boolean

Determines if this value is a valid instance of its type.

This attribute calls validate and returns a boolean value indicating if it returned no errors.

Source: javascript/web/pentaho/type/value.js, line 123

Inherited From: pentaho.type.Value#$isValid

$key: string

Gets the key of the value.

The key of a value must identify it among values of the same concrete type. Two values of the same concrete type and with the same key represent the same entity.

The default implementation returns the result of calling toString().

Source: javascript/web/pentaho/type/value.js, line 82

Inherited From: pentaho.type.Value#$key

See also:  pentaho.type.Value#equals , pentaho.type.Value.Type#areEqual

$type: pentaho.type.Value.Type

Gets the type of this instance.

Source: javascript/web/pentaho/type/value.js, line 246

Overrides: pentaho.visual.action.Data#$type

_executor: pentaho.type.action.IObserver
 
Protected

Gets the executor to which the actual action execution is delegated.

This property contains the value of the executor argument passed to execute or executeAsync, and is null before execution.

Source: javascript/web/pentaho/type/action/base.js, line 746

Inherited From: pentaho.type.action.Base#_executor

dataFilter: pentaho.data.filter.Abstract

Gets or sets the data filter of this action.

Can only be set while the action is in an editable state.

When set to a filter specification, pentaho.data.filter.spec.IAbstract, it is converted into a filter object. Any registered visual filter type can be safely loaded synchronously.

Source: javascript/web/pentaho/visual/action/data.js, line 91

Inherited From: pentaho.visual.action.Data#dataFilter

description: __nonEmptyString

Gets or sets the description of this action.

When not set to a non-empty local value, the description of the action type, pentaho.type.Type#description is returned.

Can only be set while the action is in an editable state.

Source: javascript/web/pentaho/type/action/base.js, line 380

Inherited From: pentaho.type.action.Base#description

error: Error | pentaho.lang.UserError

Gets the reason for a rejected action execution, or null.

This property can only return a non-null value if pentaho.type.action.Base#isRejected is true.

Source: javascript/web/pentaho/type/action/base.js, line 464

Inherited From: pentaho.type.action.Base#error

isCanceled: boolean

Gets a value that indicates if the action has been canceled.

Source: javascript/web/pentaho/type/action/base.js, line 510

Inherited From: pentaho.type.action.Base#isCanceled

See also:  pentaho.type.action.Base#isRejected

isCandidate: boolean

Gets a value that indicates if the action is in a candidate state.

Source: javascript/web/pentaho/type/action/base.js, line 532

Inherited From: pentaho.type.action.Base#isCandidate

isDone: boolean

Gets a value that indicates if the action executed successfully.

Source: javascript/web/pentaho/type/action/base.js, line 562

Inherited From: pentaho.type.action.Base#isDone

See also:  pentaho.type.action.Base#result

isEditable: boolean

Gets a value that indicates if the action is editable.

An action is considered editable if its state is one of init or will.

Source: javascript/web/pentaho/type/action/base.js, line 478

Inherited From: pentaho.type.action.Base#isEditable

isExecuting: boolean

Gets a value that indicates if the action is executing.

An action is executing if its state is one of init, will or do.

Source: javascript/web/pentaho/type/action/base.js, line 550

Inherited From: pentaho.type.action.Base#isExecuting

See also:  pentaho.type.action.Base#isCandidate , pentaho.type.action.Base#isFinished

isFailed: boolean

Gets a value that indicates if the action has failed.

Source: javascript/web/pentaho/type/action/base.js, line 522

Inherited From: pentaho.type.action.Base#isFailed

See also:  pentaho.type.action.Base#isRejected

isFinished: boolean

Gets a value that indicates if the action has finished execution.

An action has finished execution if its state is one of did, canceled or failed.

Source: javascript/web/pentaho/type/action/base.js, line 581

Inherited From: pentaho.type.action.Base#isFinished

See also:  pentaho.type.action.Base#isDone , pentaho.type.action.Base#isCanceled , pentaho.type.action.Base#isFailed

isRejected: boolean

Gets a value that indicates if the action has been rejected.

An action is considered rejected if its state is one of init or will.

Source: javascript/web/pentaho/type/action/base.js, line 498

Inherited From: pentaho.type.action.Base#isRejected

See also:  pentaho.type.action.Base#isCanceled , pentaho.type.action.Base#isFailed , pentaho.type.action.Base#isDone , pentaho.type.action.Base#isFinished , pentaho.type.action.Base#error

label: __nonEmptyString

Gets or sets the label of this action.

When not set to a non-empty local value, the label of the action type, pentaho.type.Type#label is returned.

Can only be set while the action is in an editable state.

Source: javascript/web/pentaho/type/action/base.js, line 359

Inherited From: pentaho.type.action.Base#label

position: pentaho.visual.spec.IPoint

Gets or sets the position where the action took place, in screen coordinates.

Can only be set while the action is in an editable state.

Source: javascript/web/pentaho/visual/action/base.js, line 103

Inherited From: pentaho.visual.action.Base#position

promise: Promise

Gets a promise for the result (or error) of this action's execution, if ever.

This promise can be requested anytime, before starting execution, during execution, or after finishing execution of this action. Also, it can be requested whether or not the action is synchronous or asynchronous.

The promise is fulfilled with the action's result or rejected with the action's error.

Source: javascript/web/pentaho/type/action/base.js, line 601

Inherited From: pentaho.type.action.Base#promise

result: any

Gets the result of a successful action execution, if any.

This property can only return a non-undefined value if pentaho.type.action.Base#isDone is true.

Source: javascript/web/pentaho/type/action/base.js, line 451

Inherited From: pentaho.type.action.Base#result

selectionMode: pentaho.visual.action.SelectionMode

Gets or sets the selection mode of this action.

Can only be set while the action is in an editable state.

The default value is the value of defaultSelectionMode.

Setting to a Nully value assumes the default value.

Can be set to the name of one of the standard selection modes, SelectionModes, to assume the corresponding selection mode function.

Source: javascript/web/pentaho/visual/action/select.js, line 151

state: pentaho.type.action.States

Gets the current action state.

Source: javascript/web/pentaho/type/action/base.js, line 399

Inherited From: pentaho.type.action.Base#state

target: pentaho.visual.base.View

Gets the target view where the action is executing or has executed.

This property contains the value of the target argument passed to execute or executeAsync, and is null before execution.

Source: javascript/web/pentaho/visual/action/base.js, line 68

Inherited From: pentaho.visual.action.Base#target

Methods Details

_assertEditable()
 
Protected

Asserts that the action is editable and throws an error if not.

Call this helper method at the start of general property setters.

Source: javascript/web/pentaho/type/action/base.js, line 412

Inherited From: pentaho.type.action.Base#_assertEditable

Throws:
Name Description
pentaho.lang.OperationInvalidError

When the action is not editable.

_configure(config)
 
Protected

Configures this value with a given non-nully configuration.

The default implementation does nothing.

Source: javascript/web/pentaho/type/value.js, line 178

Inherited From: pentaho.type.Value#_configure

Parameters:
Name Default Value Summary
config : any

The configuration.

_doDefault() : Promise

Applies the action's selectionMode function to the target view's selectionFilter and the action's dataFilter.

The resulting data filter is set as the view's new selectionFilter.

Source: javascript/web/pentaho/visual/action/select.js, line 184

Overrides: pentaho.visual.action.Data#_doDefault

Returns:
Name Description
Promise | null
  • The value null.
_onPhaseDo() : Promise
 
Protected

Called during the action's do phase.

The default implementation calls the executor's do listener, if any.

Source: javascript/web/pentaho/type/action/base.js, line 1183

Inherited From: pentaho.type.action.Base#_onPhaseDo

Returns:
Name Description
Promise | null

A promise to the completion of the asynchronous do listener, of an asynchronous action, or null.

_onPhaseFinally()
 
Protected

Called during the action's finally phase.

The default implementation calls the executor's finally listener, if any.

Source: javascript/web/pentaho/type/action/base.js, line 1198

Inherited From: pentaho.type.action.Base#_onPhaseFinally

_onPhaseInit()
 
Protected

Called during the action's initialize phase.

The default implementation calls the executor's init listener, if any.

Source: javascript/web/pentaho/type/action/base.js, line 1150

Inherited From: pentaho.type.action.Base#_onPhaseInit

_onPhaseWill()
 
Protected

Called during the action's will phase.

The default implementation calls the executor's will listener, if any.

Source: javascript/web/pentaho/type/action/base.js, line 1165

Inherited From: pentaho.type.action.Base#_onPhaseWill

_setTarget(target)
 
Protected

Called to validate and set the action's target, upon execution.

Override to perform additional validations after calling the base implementation.

Source: javascript/web/pentaho/type/action/base.js, line 726

Inherited From: pentaho.type.action.Base#_setTarget

Parameters:
Name Default Value Summary
target : pentaho.type.action.ITarget

The action's target.

assertValid()

Ensures that the value is valid, and throws the first validation error if it is not.

This method calls the validate method.

Source: javascript/web/pentaho/type/value.js, line 152

Inherited From: pentaho.type.Value#assertValid

Throws:
Name Description
pentaho.type.ValidationError

When the value is not valid, the first error returned by the validate method.

clone() : pentaho.type.Value

Creates a shallow clone of this value.

Source: javascript/web/pentaho/type/value.js, line 86

Inherited From: pentaho.type.Value#clone

Returns:
Name Description
pentaho.type.Value

The value clone.

Implements:
configure(config) : pentaho.type.Value

Configures this value with a given configuration.

Source: javascript/web/pentaho/type/value.js, line 165

Inherited From: pentaho.type.Value#configure

Parameters:
Name Default Value Summary
config : any

The configuration.

Returns:
Name Description
pentaho.type.Value

This instance.

done(result) : pentaho.type.action.Base

Called from an action observer to mark the action as being done, optionally given a result value.

Source: javascript/web/pentaho/type/action/base.js, line 775

Inherited From: pentaho.type.action.Base#done

Parameters:
Name Default Value Summary
result : any
 
Optional

The result of the action, if any.

Returns:
Name Description
pentaho.type.action.Base

The value of this.

Throws:
Name Description
pentaho.lang.OperationInvalidError

When the action is not in the do state.

equals(other) : boolean

Determines if a given value, of the same type, represents the same entity.

The default implementation delegates the operation to the _isEqual method.

Source: javascript/web/pentaho/type/value.js, line 107

Inherited From: pentaho.type.Value#equals

Parameters:
Name Default Value Summary
other : any

A value to test for equality.

Returns:
Name Description
boolean

true if the given value is equal to this one; or, false, otherwise.

See also:  pentaho.type.Value#$key , pentaho.type.Value.Type#areEqual

execute(target, executor) : pentaho.type.action.Base

Executes the action on a given target and, optionally, with a given executor, and does not wait for its outcome.

This method can be called on synchronous or asynchronous actions. However, in the latter case, this method is only suitable for fire-and-forget scenarios, where it is not needed to know the action outcome.

Source: javascript/web/pentaho/type/action/base.js, line 661

Inherited From: pentaho.type.action.Base#execute

Parameters:
Name Default Value Summary
target : pentaho.type.action.ITarget

The action's target.

executor : pentaho.type.action.IObserver
 
Optional

An action observer to act as action controller/executor. Unlike normal event/action observers, the functions of executor observers are called with the executor as the value of the JavaScript this context.

Returns:
Name Description
pentaho.type.action.Base

The value of this.

See also:  pentaho.type.action.ITarget#executeAsync , pentaho.type.action.ITarget#act

executeAsync(target, executor) : Promise

Executes the action on a given target and, optionally, with a given executor, and waits for its outcome.

This method can be called on synchronous or asynchronous actions, and can be used when uniformity in treatment is desired and it is needed to know their outcome.

Source: javascript/web/pentaho/type/action/base.js, line 688

Inherited From: pentaho.type.action.Base#executeAsync

Parameters:
Name Default Value Summary
target : pentaho.type.action.ITarget

The action's target.

executor : pentaho.type.action.IObserver
 
Optional

An action observer to act as action controller/executor. Unlike normal event/action observers, the functions of executor observers are called with the executor as the value of the JavaScript this context.

Returns:
Name Description
Promise

A promise that is fulfilled with the action's result or rejected with the action's error.

See also:  pentaho.type.action.ITarget#execute , pentaho.type.action.ITarget#actAsync

reject(reason) : pentaho.type.action.Base

Called from an action observer to mark the action as rejected.

The action is considered failed if reason is an instance of Error (that is not an instance of UserError) or if it is an instance of RuntimeError.

Otherwise, the action is considered canceled if reason is a string or an instance of UserError (that is not an instance of RuntimeError).

Source: javascript/web/pentaho/type/action/base.js, line 843

Inherited From: pentaho.type.action.Base#reject

Parameters:
Name Default Value Summary
reason : string | Error
 
Optional

The reason for the rejection.

Returns:
Name Description
pentaho.type.action.Base

The value of this.

Throws:
Name Description
pentaho.lang.OperationInvalidError

When canceling and the action is not in one of the states init or will.

pentaho.lang.OperationInvalidError

When failing and the action is not executing.

See also:  pentaho.type.action.Base#isRejected , pentaho.type.action.Base#isCanceled , pentaho.type.action.Base#isFailed , pentaho.type.action.Base#error

Example

define([
 "pentaho/lang/UserError",
 "pentaho/lang/RuntimeError"
], function(UserError, RuntimeError) {

 // ...

 target.on("fly", {
 will: function(action) {
 // Canceling the action
 // .. Method 1
 action.reject("Cannot do this action now.");

 // .. Method 2
 action.reject(new UserError("Cannot do this action now."));

 // Failing the action
 // .. Method 1 - message is not adequate to be shown to the user.
 action.reject(new Error("Null Pointer Exception."));

 // .. Method 2 - message is adequate to be shown to the user.
 action.reject(new RuntimeError("The server is currently unreachable."));
 }
 });

 // ...
});
toJSON() : UJsonValue

Creates a top-level JSON specification that describes this instance.

Attributes which do not have a JSON-compatible specification are omitted. Specifically, for inline types, attributes with a function value are not supported.

This method simply calls pentaho.type.Instance#toSpec with argument keyArgs.isJson as true and exists for seamless integration with JavaScript's JSON.stringify method.

Source: javascript/web/pentaho/type/instance.js, line 210

Inherited From: pentaho.type.Instance#toJSON

Returns:
Name Description
UJsonValue

A JSON-compatible specification.

See also:  pentaho.type.Instance#toSpec

Implements:
toSpec(keyArgs) : pentaho.type.spec.UInstance

Creates a specification that describes this value.

If an ambient specification context, currently exists, it is used to manage the serialization process. Otherwise, one is created and set as current. Then, the actual work is delegated to pentaho.type.Instance#toSpecInContext.

Source: javascript/web/pentaho/type/value.js, line 184

Inherited From: pentaho.type.Value#toSpec

Parameters:
Name Default Value Summary
keyArgs : Object
 
Optional

The keyword arguments object. Passed to every value and type serialized within this scope.

Please see the documentation of value subclasses for information on additional, supported keyword arguments.

Parameters:
Name Default Value Summary
isJson : boolean
 
Optional
false

Generates a JSON-compatible specification. Attributes which do not have a JSON-compatible specification are omitted.

declaredType : pentaho.type.Type
 
Optional

The base type of this value's storage location. If the value does not have this exact type, its inline type property must be included in the specification. Otherwise, it can be omitted. When unspecified, the inline type property is only included if forceType is true.

forceType : boolean
 
Optional
false

Forces inclusion of the inline type property, _, in the specification.

omitFormatted : boolean
 
Optional
false

Omits the formatted value on Simple values' specifications.

preferPropertyArray : boolean
 
Optional
false

Indicates that, if possible, array form is used for Complex values' specifications.

The array form of a complex value cannot be used when its type must be inlined.

includeDefaults : boolean
 
Optional
false

When true, all of the properties of Complex values are serialized. When false, the default, only properties whose value is different from their default value are serialized.

Only applies to complex values that are serialized in object form. In array form, all of the properties of complex values are serialized independently of their value.

omitProps : Object
 
Optional

An object whose own property names with a truthy value are the names of the properties of the current complex type to omit from the serialization.

Only applies when a complex is output in object form. In array form, all properties are output whatever their value.

This argument only applies to complex values and is not passed through to the values of their properties.

Returns:
Name Description
pentaho.type.spec.UInstance

A specification of this value.

toSpecInContext(keyArgs) : any

Creates a specification that describes this instance.

Source: javascript/web/pentaho/type/instance.js, line 190

Overrides: pentaho.visual.action.Data#toSpecInContext

Parameters:
Name Default Value Summary
keyArgs : Object
 
Optional

The keyword arguments' object. Passed to every instance and type serialized within this scope.

Please see the documentation of subclasses for information on additional, supported keyword arguments.

Returns:
Name Description
any

A specification of this instance.

See also:  pentaho.type.Instance#toSpec

validate() : Array.<pentaho.type.ValidationError>

Determines if this value is a valid instance of its type.

The default implementation delegates to pentaho.type.Value.Type#_validate.

Source: javascript/web/pentaho/type/value.js, line 137

Inherited From: pentaho.type.Value#validate

Returns:
Name Description
Array.<pentaho.type.ValidationError>

A non-empty array of errors or null.

See also:  pentaho.type.Value#$isValid