Versions Compared

Key

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

...

A component's grade should be specified using the gradeNames option in the components defaults block, as shown in the examples below. The gradeNames option is a string or an array of strings.

NOTE: In the examples below, the autoInit flag is not actually a grade, but is added to the gradeNames array to control how the component is created. See #Initializing Graded Components below for more information about the autoInit flag. The autoInit flag is the preferred method of component creation, and will soon become the default. Always use the "autoInit" flag, unless you have a very good reason not to.

Code Block
javascript
javascript
fluid.defaults("fluid.uploader.demoRemote", {
    gradeNames: ["fluid.eventedComponent", "autoInit"],
    ...
});
Code Block
javascript
javascript
fluid.defaults("cspace.messageBarImpl", {
    gradeNames: ["fluid.rendererComponent", "autoInit"],
    ...
});

In the example below, the autoInit flag is not actually a grade, but is added to the gradeNames array to control how the component is created. See #Initializing Graded Components below for more information about the autoInit flag.

Code Block
javascript
javascript
fluid.defaults("cspace.util.relationResolver", {
    gradeNames: ["fluid.modelComponent", "autoInit"],
    ...
});

NOTE: The autoInit flag is the preferred method of component creation, and will soon become the default. Always use the "autoInit" flag, unless you have a very good reason not to.

Initializing Graded Components

...

Code Block
javascript
javascript
fluid.defaults("cspace.tabs", {
    gradeNames: ["fluid.viewComponent", "autoInit"],
    ...
});
cspace.tabs = function (container, options) {
    var that = fluid.initView("cspace.tabs", container, options);
    that.refreshView = function () {
       ...
    };
    ...
};