Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Section
Column
width65%

The framework merges a component's defaults with the options specified by the user at runtime. Default options for a component are registered by the component developer using the fluid.defaults() function. The framework combines these values with those supplied by the user to the component creator function.

Column
Panel
borderColor#566b30
bgColor#fff
titleBGColor#D3E3C4
titleOn this Page
borderStylesolid
Table of Contents
maxLevel6
minLevel4maxLevel6
excludeIntroduction*

Left unchecked, this options merging code becomes unruly and verbose. The vast majority of merging can be taken care of by a simple call to a standard "object merging function" such as jQuery.extend - however, there are a few cases where this behaviour is inappropriate, and where manual merging code might still be required.

...

Code Block
javascript
javascript
   fluid.merge(policy, target, source-1, ... source-n);

...

Policy value

Description

"replace"

If any value is found at the EL path in a "source" object, the value held at the "target" path will be cleared (that is, blasted back to an empty state with no properties) before the values are copied.

New in v1.3:DEPRECATED
"preserve"

If any value is found at the EL path in a "source" object, the source object will be preserved i.e. the object will not be copied, but directly used. If any defaults exist, those will be merged into the source object.New in v1.4:

"noexpand"

 New in v1.4:

"nomerge"

 

"reverse"

This is scheduled for deprecation

Any other string value

The value will be interpreted as an EL path into source object. If after the merge operation, no value is present at the key EL value in the target object, this (right-hand) value will be interpreted as an EL path into the source, and the value copied from this EL into the key EL into the target.

function

Rather than perform any merge operation, the key will be interpreted as a function which is expected to accept two arguments (target, source) representing the sub-objects which are about to enter merging. The function will be invoked on these arguments and no further operations will be performed on this subtree.