This documentation is currently being moved to our new documentation site.
Please view or edit the documentation there, instead.
If you're looking for Fluid Project coordination, design, communication, etc, try the Fluid Project Wiki.
Renderer Component Tree Expanders
The Renderer offers some utility functions for simplifying the tree-creation process. These functions are called expanders because they expand information you provide into a full component tree. These expanders are specified in the prototree itself by name and and are provided options to control the expansion process. For example:
Using Expanders
Expanders are specified as wrappers around a component specification in the component tree: Instead of the usual componentID: {specification} form, the keyword expander is used, as shown below:
var tree = {
expander: {
type: "fluid.renderer.repeat",
repeatID: "tab:",
....
}
};
You can also specify multiple expanders within a prototree by providing an array of expander specification in the expander field, as shown below:
var tree = {
expander: [
{
type: "fluid.renderer.repeat",
repeatID: "tab:",
....
},
{
type: "fluid.renderer.selection.inputs",
selectID: "language",
....
},
....
]
};
Available Expanders
Repetition Expander
The repetition expander takes care of replicating part of the prototree as many times as are required based on the data in the the model.
The following fields are supported by the fluid.renderer.repeat expander (required fields are bolded):
Field | Description | Values | Default |
|---|---|---|---|
| The type of the expander | "fluid.renderer.repeat" | N/A |
| the id to use | String |
|
| EL path of repeated data in model | String |
|
| A prototree snippet to use for the repeated data | Object |
|
| The string that will be used in the | String | none |
|
| String | none |
|
| boolean | false |
Example
Selection To Inputs Expander
The simple "Select" protocomponent format shown on the ProtoComponent Types page is sufficient for a <select> element, but radio buttons and check boxes must also have entries for each button or box. The "selection to inputs" expander will automatically generate these entries based on the options available in the select.
The following fields are supported by the fluid.renderer.selection.inputs expander (required fields are bolded):
Field | Description | Values | Default |
|---|---|---|---|
| The type of the expander | "fluid.renderer.selection.inputs" | N/A |
| The ID of the selection itself. | String | none |
| The ID of the input element associated with the select. | String | none |
| The ID of the template for the row that is to be repeated for each possible selection. | String | none |
| The ID of the label for the input element. | String | none |
| The prototree snippet containing the selection that is to be expanded | Object | none |
Example
var tree = {
expander: {
type: "fluid.renderer.selection.inputs",
rowID: "layout",
labelID: "layoutLabel",
inputID: "layoutChoice",
selectID: "layout-checkbox",
tree: {
selection: "${layouts.selection}",
optionlist: "${layouts.choices}",
optionnames: "${layouts.names}"
}
}
};
Condition Expander
The condition expander provides a mechanism for selecting between two alternative renderer component sub-trees based on the outcome of a condition e.g. the boolean evaluation of a value, or the return value of a function call.
The following fields are supported by the fluid.renderer.condition expander (required fields are bolded):
Field | Description | Values | Default |
|---|---|---|---|
| The type of the expander | "fluid.renderer.condition" | N/A |
| An object that can be evaluated as | Object or Function | none |
| (optional) A component sub-tree to be used in the case that the | Object | none |
| (optional) A component sub-tree to be used in the case that the | Object | none |