CisModel Instance Methods

The most commonly accessed instance of CisModel is the central model containing the data for the current page, typically available through the "main" global variable in most frames. (Recall again that all such globals refer to the same object; hence changes made with code running in one iframe are visible from any other iframe.)

  • getValue(fieldName)

This accessor method returns the data value corresponding to the provided fieldName. The field name string will be cracked into constituent pieces using the static parseNames() method, in order to identify the instance of DataElement within the data "tree" that contains the desired property, and then to retrieve the property.

  • getOriginalValue(fieldName)

If a model property has been modified, but the change has not yet been committed (e.g. with the Save button), the system tracks the originally retrieved value of the property. This accessor method can be used to retrieve the original value. Useful for implementing certain business rules having to do with logical state transitions.

  • canSetValue(fieldName, value)

This method answers a boolean indicating whether the model is capable of accepting the given value for the provided fieldName. The method would answer false if buffer capacity limits would be exceeded were the change to be accepted.

  • setValue(fieldName, value)

This setter modifies the property identified by fieldName to hold the given value. Defaulting will not be triggered.

  • setLocalValueWithDefault(fieldName, localValue)

Sets the property identified by the given fieldName to the specified localValue. This method does not handle conversion errors, so the provided localValue should have already passed syntactic validation.

  • setValueWithDefault(clientWindow, fieldName, value, element, afterFieldUpdateFunction, continuation, forceDefault, skipDefault, successFunction)

Sets the property identified by the given fieldName to the specified value. This method may trigger a default, and therefore requires further parameters:

clientWindow - the window object containing the element triggering the default.

element - the HTML element that is attempting to accept the value.

afterFieldUpdateFunction - a thread-safe continuation to be run after the value has been changed

continuation - a function to be run whether or not the value can be accepted (may be null)

forceDefault - an optional boolean that forces the default checking code to run, bypassing a shortcut execution path (presumeably to obtain a desired side-effect from defaulting)

skipDefault - an optional boolean that bypasses the default triggering logic

successFunction - continuation to execute if the value is accepted by the default logic

Note: Note this function is not "thread-safe", in the sense that it cannot be safely called e.g. in a loop that may issue several calls to this function. The workaround is to make use of the continuation function to "schedule" the follow-up operation.
  • setListPosition(listName, newPosition)

Sets the list identified by the given listName to the position (a zero-based integer value) given by newPosition. Useful when you want to display a particular element in a scroll.

  • getList(listName)

Answers the list object (instance of List) with the given name.

  • replaceWithNewList(listName, sourceModel)

Typically called from the default handler callback, this method replaces the entire contents of the given list in the receiver (e.g. the model whose method is being called) with the list as provided in sourceModel. All elements in the list are considered new, and are eligible to be added to the database when the Save button is used.

  • hasRealElements(listName)

Answer a boolean indicating whether the indicated list contains any persistent or dirty elements (not merely a single phantom).

  • getElement(fieldName)

Returns the data element (instance of DataElement) corresponding to the given field name. The method resolves the list name and position index, if any, in order to navigate to the appropriate data element.

  • markAsNew()

Mark the model "clean" by recursively clearing all dirty flags throughout the tree structure. Note this is a very "sensitive" method and should only rarely be needed.