Child pages
  • Expansion of Component Options

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Name

Description

type

This is the string name of the expander. Currently, several expanders are provided by the framework, and are described below.

func

Some expanders call user-provided function. In these cases, this property is the string name of the user-provided function.

args

This is an array of arguments to be passed to the user-provided function specified in func.

href

 

options

 

resourceSpecCollector

 

fetchKey

 

value

Use in fluid.noexpand type only. In this case, a non-object value can be specified for this property and will be returned.

tree

Use in fluid.noexpand type only. In this case, an object can be specified for this property and will be returned without expansion.

Supported Expanders

Three expanders are currently provided by the framework, and component creators can specify these expanders in their default options:

...

Section
Column
width50%
Code Block
javascript
javascript
fluid.defaults("cspace.specBuilderImpl", {
    urlRenderer: {
        expander: {
            type: "fluid.deferredInvokeCall",
            func: "cspace.urlExpander"
        }
    }  
});
cspace.urlExpander = function (options) {
    ...
    return function (url) {
        ...
    };
};
fluid.demands("cspace.urlExpander", "cspace.test", 
    {
    args: {
        vars: {
            webapp: "../../main/webapp"
        }
    }
});
Column

In this example, the function name cspace.urlExpander will be resolved before being invoked. In a production setting, no arguments will be passed (since none are specified in the expander object. But in a test environment (i.e when "cspace.test" has been registered as an environment), the demands specification be resolved and the specified arguments will be passed to the function.

Note: Demands are deprecated. Use dynamic grades and distributeOptions instead.

fluid.noexpand

The fluid.noexpand expander simply unwraps one level of expansion and ceases. For example:

Section
Column
width50%
Code Block
javascript
javascript
fluid.defaults("cspace.specBuilder", {
    components: {
        specBuilderImpl: {
            type: "cspace.specBuilderImpl",
            options: {
                unexpanded: {
                    expander: {
                        type: "fluid.noexpand",
                        funcvalue: "{specBuilder}.value"
                    }
                }
            }
        }
    }
});
Column

In this example, the function name {specBuilder}.urlExpander will NOT be resolved as an IoC reference. The value {specBuilder}.urlExpander will be assigned to the option unexpanded.

Section
Column
width50%
Code Block
javascript
javascript
fluid.defaults("cspace.specBuilder", {
    components: {
        specBuilderImpl: {
            type: "cspace.specBuilderImpl",
            options: {
                expander: {
                    type: "fluid.noexpand",
                    tree: {
						unexpandedTop: "{specBuilder}.value"
                	}
				}
			 }
		}
	}
 });
Column

In this example, a new option UnexpandedTop will be added with a value {specBuilder}.urlExpander. {specBuilder}.urlExpander will NOT be resolved as an IoC reference.