ScenarioObserver
Method summary
name | description |
---|---|
bindAutoForm | Bind an AutoForm DOM element that matches the formId property in the options argument. |
bindAutoTable | Bind AutoTable configuration to a specified DOM table element and update the AutoTable whenever there are data changes. |
bindAutoText | Bind AutoText elements from the DOM that match the selector property in the options argument. |
bindImageAttachments | Bind IMG elements marked with the 'data-attachment-filename' attribute, to display image attachments in the page. |
dispose | This stops the event listener for the configured scenarios and entities. |
filter | Apply a filter to an entity. |
isDisposed | Check if the scenario observer is disposed. |
notify | Add a function to be called with the requested data whenever there are changes to that data. |
once | Add a function to be called once with the requested data and then dispose this observer. |
start | This tells the system to go and fetch the configured scenarios and entities and return their values. Also it starts listening for change events on those scenarios and entities. |
withAttachments | Registers this observer to be notified whenever the scenario attachments change. |
withEntities | Specify the entities this scenario observer is interested in. |
withSummaryData | Registers this observer to be notified whenever the scenario summary data changes. |
withViewProperties | Specify the view properties this scenario observer is interested in. |
Methods
- bindAutoForm ( options ) → {ScenarioObserver}
-
Bind an AutoForm DOM element that matches the formId property in the options argument.
Parameters:
paramsName Type Description options typeScenarioObserver~BindAutoFormOptionsAutoForm binding options detailsReturns:returns tableType Description typeScenarioObserver - bindAutoTable ( options ) → {ScenarioObserver}
-
Bind an AutoTable DOM element that matches the tableId property in the options argument. The options and overrides objects passed in should match the AutoTable constructor arguments except where it is expecting Scenario objects you can pass scenario id and they will get resolved.
Parameters:
paramsName Type Description options typeScenarioObserver~BindAutoTableOptionsAutoTable binding options detailsReturns:returns tableType Description typeScenarioObserver - bindAutoText ( options ) → {ScenarioObserver}
-
Bind AutoText elements from the DOM that match the selector property in the options argument. Alternatively, if a string arguments is passed in the this acts as the selector.
Parameters:
paramsName Type Description options typeScenarioObserver~BindAutoTextOptions | stringAutoText binding options object or the the selector is a string detailsReturns:returns tableType Description typeScenarioObserver - bindImageAttachments ( options ) → {ScenarioObserver}
-
Bind IMG elements marked with the 'data-attachment-filename' attribute, to display image attachments in the page.
Parameters:
paramsName Type Description options typeScenarioObserver~BindImageAttachmentOptions | jQuery | stringan image attachment binding options object, a jQuery selector or a CSS selector string detailsReturns:returns tableType Description typeScenarioObserver - dispose ( )
-
This stops the event listener for the configured scenarios and entities. The notify callback or bound auto components related to this scenario observer will not receive any further updates.
details - filter ( entity, callback ) → {ScenarioObserver}
-
Apply a filter to an entity.
Parameters:
paramsName Type Description entity typestringthe entity name to filter on callback typeScenarioObserver~FilterCallbackthe filter to apply detailsReturns:returns tableType Description typeScenarioObserverExample
examples
Back to Topinsight.getView() .withFirstScenario() .withViewProperties('selectedDay') .withEntities('SUPPLY') .filter('SUPPLY', function (viewProperties) { // Array filter: filters the 'DAY' index of the array by the value of a view property called // 'selectedDay' and filters the 'REGION' index of the array by hard-coded values. return { 'DAY': [viewProperties.get('selectedDay')], 'REGION': ['SOUTH', 'WEST'] } }) .notify(function (scenario) {}) .start();
- isDisposed ( ) → {boolean}
-
Check if the scenario observer is disposed.
detailsReturns:returns tableType Description typebooleanWhether this scenario observer is disposed - notify ( callback ) → {ScenarioObserver}
-
Add a function to be called when there are data changes, depending on what has been subscribed to.
Parameters:
paramsName Type Description callback typeNotifyCallbackthe callback to invoke detailsReturns:returns tableType Description typeScenarioObserver - once ( callback ) → {ScenarioObserver}
-
Add a function to be called once with the requested data and then dispose this observer. once() and notify() are mutually exclusive.
Parameters:
paramsName Type Description callback typeNotifyCallbackthe callback to invoke detailsReturns:returns tableType Description typeScenarioObserver - start ( ) → {ScenarioObserver}
-
This tells the system to go and fetch the configured scenarios and entities and return their values. Also it starts listening for change events on those scenarios and entities.
detailsReturns:returns tableType Description typeScenarioObserver - withAttachments ( options ) → {ScenarioObserver}
-
Registers this observer to be notified whenever the scenario or project attachments change.
The argument to this function can be one of the following:- An array of tags to observe.
- A single tag to observe.
- A configuration object (of type WithAttachmentsOptions) indicating which tags to observe and whether to observe scenario or project attachments.
Parameters:
paramsName Type Description options typeScenarioObserver~WithAttachmentsOptionsdetailsReturns:returns tableType Description typeScenarioObserverExample
examples
Back to Topinsight.ready(function () { var view = insight.getView(); view .withFirstScenario() .withAttachments({tags: ['tagA', 'tagB'], project: true, scenario: true}) .notify(function (scenario) { // code to access attachments here... }); });
- withEntities ( entities ) → {ScenarioObserver}
-
Specify the entities this scenario observer is interested in.
Parameters:
paramsName Type Description entities typestring | Array.<string>the entities to observe detailsReturns:returns tableType Description typeScenarioObserver - withSummaryData ( ) → {ScenarioObserver}
-
Registers this observer to be notified whenever the scenario summary changes. Can be used in combination with
ScenarioObserver#withEntities
to get notified when either the summary data or entity data change.detailsReturns:returns tableType Description typeScenarioObserver - withViewProperties ( viewProperties ) → {ScenarioObserver}
-
Specify the view properties this scenario observer is interested in.
Parameters:
paramsName Type Description viewProperties typestring | Array.<string>the view properties to observe detailsReturns:returns tableType Description typeScenarioObserver
Type Definitions
-
BindAutoFormOptions - {
typeobject }
-
details
Properties:
propertiesName Type Argument Description formId typestringid of the DOM element to bind to scenario typestring | numberoptional the scenario id or index to use, defaults to the first scenario in the selection loadButton typestringoptional id of the DOM element to bind the load action to runButton typestringoptional id of the DOM element to bind the run action to saveButton typestringoptional id of the DOM element to bind the save action to cancelButton typestringoptional id of the DOM element to bind the cancel action to additionalBindings typeobjectoptional additional binding information passed in to the AutoForm. See the AutoForm#bindForm inputs argument - BindAutoTableError ( error )
-
Parameters:
paramsName Type Description error typeErrorThe error encountered details -
BindAutoTableOptions - {
typeobject }
-
details
Properties:
propertiesName Type Argument Default Description tableId typestringid of the DOM table element to bind to scenario typestring | numberoptional scenario id or index to use, defaults to the first scenario in the selection columnOptions typeArray.<AutoTable~ColumnOptions>optional list of column options for AutoTable. The scenario properties on columns can be specified as a scenario index or id and they will automatically be transposed into Scenario objects indicesOptions typeObject.<string, (AutoTable~IndicesOptions|Array.<AutoTable~IndicesOptions>)>optional map of indices options for AutoTable overrides typeobjectoptional map of DataTables overrides for AutoTable addRemoveRow typebooleanoptional false enable the add/remove row functionality. See the AutoTable constructor onError typeScenarioObserver~BindAutoTableErroroptional Callback if Autotable creation leads to error -
BindAutoTextOptions - {
typeobject }
-
details
Properties:
propertiesName Type Argument Description selector typestringa jQuery selector defining the DOM elements to bind to scenario typestring | numberoptional the scenario id or index to use, defaults to the first scenario in the selection -
BindImageAttachmentOptions - {
typeobject }
-
details
Properties:
propertiesName Type Description selector typestringa jQuery selector or CSS selector string defining the IMG elements to bind to within the DOM - FilterCallback ( viewProperties ) → {Object.<(string|number), *>}
-
Filter callback to apply to the entity.
At times it is desirable to only retrieve a slice of an array, i.e. only retrieve the elements for a subset of the array's index values. This callback should return an object containing an array of values to use for each index set. If the index set is not included in the object then all values in the index set are used. The index set can either be specified by name or by ordinal. (The first index set of the array has ordinal 0.)Parameters:
paramsName Type Description viewProperties typeMaskedViewPropertiesOnly allows access to the view properties that this scenario observer is listening to detailsReturns:returns tableType Description typeObject.<(string|number), *>the filter; a map from index set name (or ordinal) to array of filter values Example
examples
Back to Top// Array filter: filters the second index of the array by the value of a view property called 'selectedDay' function (viewProperties) { return { 1: [viewProperties.get('selectedDay')] } } // Array filter: filters the 'DAY' index of the array by the value of a view property called 'selectedDay' and // filters the 'REGION' index of the array by hard-coded values. function (viewProperties) { return { 'DAY': [viewProperties.get('selectedDay')], 'REGION': ['SOUTH', 'WEST'] } }
-
ScenarioObserverOptions - {
typeobject }
-
details
Properties:
propertiesName Type Argument Description disposeCallback typefunctionoptional to be called when the observer is disposed startCallback typefunctionoptional to be called when the observer is started -
WithAttachmentsOptions - {
typeobject }
-
details
Properties:
propertiesName Type Argument Default Description tags typestring | Array.<string>optional List of tags to observe (if not provided, all attachments will be observed) filenames typestring | Array.<string>optional List of filenames to observe (if not provided, all attachments will be observed) scenario typebooleanoptional true Whether to notify the callback when scenario attachments are changed project typebooleanoptional true Whether to notify the callback when project attachments are changed ScenarioObserver#withAttachments argument
© 2001-2019 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.