Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Div
classapi-page

fluid.defaults(componentName, defaults)

Section
Column
width70%

Centrally stores and retrieves a component's default settings.

Code Block
javascript
javascript
bgColorwhite
borderStylenonejavascript
fluid.defaults(componentName, defaults);

File name: Fluid.js

Parameters

Span
classborderless-table

componentName

(String) the name of the component

defaults

(Object) a container of key/value pairs to set. See #Defaults Structure below for information about the format of this object.

Return Value

Span
classborderless-table

Object

If the object is passed in the argument, this is added to the store and then returned. If not, the current object in the store is returned.

Column
width5%
 
Column

See Also


Notes

Defaults Structure

The defaults object ...

Span
classborderless-table
Code Block
javascript
javascript
{
    option1: <default value for option one>,
    option2: {
        subOpt1: <default for sub-option1>,
        subOpt2: <default for sub-option1>
    }
}

The array of arguments can contain references to...

Example

Code Block
javascript
javascript
fluid.defaults("inlineEdit", {
    selectors: {
        text: ".text",
        editContainer: ".editContainer",
        edit: ".edit"
},

In this example, the default selectors(text, editContainer, edit) for inlineEdit are set to the element with the following classes respectively, text, editContainer, edit. As the componenent's creator starts up, it will merge together the user's instance options to produce its runtime options.