Div | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||
|
distributeOptions and IoCSS: Downward-Matching CSS-Like Context Selectors For Options Forwarding
...
Name | Description |
---|---|
| (Required) An IoC expression describing the location in the component tree where the options are to be set. The "context" part of this expression will usually consist of an IoCSS selector (see below for format). However, it may also in specialised cases consist of a standard "upwards" IoC context expression, indicating that options are to be distributed to a parent component (this is only meaningful in the case the parent has not finished instantiating). |
| (Mutually exclusive with |
record | (Mutually exclusive with |
removeSource | (Only possible if source is used) true/false: If true, the source options block is removed from its original site in the options structure when it is forwarded to the target . |
| (Only possible if |
...
Code Block | ||||
---|---|---|---|---|
| ||||
fluid.defaults("fluid.tests.uploader", { gradeNames: ["fluid.littleComponent", "autoInit"], components: { uploaderContext: { type: "fluid.progressiveCheckerForComponent", options: {componentName: "fluid.tests.uploader"} }, uploaderImpl: { type: "fluid.tests.uploaderImpl" } }, distributeOptions: [{ target: "{that > uploaderImpl}.options" // Target a directly nested component matching the context "uploaderImpl" source: "{that}.options", // Distribute ALL of our options there, except exclusions: exclusions: ["components.uploaderContext", "components.uploaderImpl"], // options targetted directly at these subcomponents are left undisturbed in place }], progressiveCheckerOptions: { checks: [ { feature: "{fluid.test}", contextName: "fluid.uploader.html5" } ] } }); |
Example: record
Code Block | ||||
---|---|---|---|---|
| ||||
fluid.defaults("fluid.moduleLayoutHandler", { gradeNames: ["fluid.layoutHandler", "autoInit"], ... distributeOptions: { target: "{reorderer}.options", // unusual: upward-matching selector distributes options back to parent before instantiation ends record: { selectors: { movables: { expander: { func: "{that}.makeComputeModules", args: [false], } }, dropTargets: { expander: { func: "{that}.makeComputeModules", args: [false], } }, selectables: { expander: { func: "{that}.makeComputeModules", args: [true], } } } } } }); |