Versions Compared


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


Since the fluid.defaults directive introduces a grade into the system, various components can be composed to create new ones. Options, fields and methods introduced by the ancestor grades will be merged and preserved. The merging happens, firstly in hierarchical order (grades comprising the ancestor grade are resolved before the actual component grades resolution) and secondly in the left-to-right order (defaults from the grade on the right tacking precedence over the defaults from the grade on the left, more details can be found here -

serverFluid Project Issue Tracker
). For example:


Code Block
fluid.defaults("fluid.componentOne", {
    gradeNames: ["fluid.modelComponent", "autoInit"],
    model: {
		field1: true
	option1: "TEST"

fluid.defaults("fluid.componentTwo", {
    gradeNames: ["fluid.modelComponent", "autoInit"],
    model: {
		field1: false,
		field2: true
	option2: "TEST2"

fluid.defaults("fluid.combinedComponent", {
    gradeNames: ["fluid.componentOne", "fluid.componentTwo"]
    // The actual component defaults will look like this:
    // model: {
    //     field1: false,
    //     field2: true
    // },
    // option1: "TEST",
    // option2: "TEST2"