Div |
---|
class | Wiki Markup |
---|
{div:class=api-page | }
h1. fluid.defaults(global, componentName, defaults) Section |
---|
Column |
---|
|
|
Centrally stores and retrieves a
{section}
{column:width=70%}
Centrally stores and retrieves a component's default settings.
{code
javascript | javascript | bgColor | white |
---|
borderStyle | none |
---|
:javascript|borderStyle=none|bgColor=white}
fluid.defaults(global, componentName, defaults);
{code}
*File name:* {{Fluid.js
Parameters
Span |
---|
|
global | (boolean) Optional: If true, manipulate a global option (for the head component) rather than instance options. Note that this is deprecated as of v1.3 | 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 |
---|
|
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 |
---|
|
Notes
Defaults Structure
The defaults object ...
Span |
---|
|
Code Block |
---|
javascript | javascript | }}
h2. Parameters
{span:class=borderless-table}
| {{{*}global{*}}} | (boolean) Optional: If true, manipulate a global option (for the head component) rather than instance options. {color:purple}Note that this is deprecated as of v1.3{color} |
| {{{*}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. |
{span}
h2. Return Value
{span:class=borderless-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. |
{span}
{column}
{column:width=5%}
{column}
{column}
h3. See Also
* [Fluid Component API]
* [fluid.mergeComponentOptions]
* [Fluid Component Options|Infusion13:Fluid Component API#Options]
{column}
{section}
----
h3. Notes
h4. Defaults Structure
The defaults object ...
{span:class=borderless-table}
| {code:javascript}
{
option1: <default value for option one>,
option2: {
subOpt1: <default for sub-option1>,
subOpt2: <default for sub-option1>
}
}
{code} |
The array of arguments can contain references to...
Example
Code Block |
---|
javascript | javascript | |
{span}
h3. Example
{code:javascript}
fluid.defaults("inlineEdit", {
selectors: {
text: ".text",
editContainer: ".editContainer",
edit: ".edit"
},
{code}
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.
{div}