Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Div
classcomponent-api-page

Anchor
top
top

The Model Builder subcomponent is used by Table of Contents API to convert a flat list of headings into a hierarchical list suitable for the Table of Contents.

Do not use this component directly. The information on this page should be use when customizing Table of Contents.

See Also
Table of Contents API

Div
classsummary-table

Supported Events

none

#Methods

#modelLevelFn
Used to determine how to nest heading.

#toModel
Use to actually build the nested model.

Options

none

Subcomponents

headingCalculator
Calculates the heading level.

Methods

Span
classback-to-top
back to top
Include Page
_methods intro
_methods intro

modelLevelFn

Div
classapi-table

Description

Used by the #toModel method to decide how deeply to nest a heading in the Table of Contents. The default implementation creates a nested hierarchy that uses incremental depths, independent of the actual heading levels.

Parameters

modelLevel
An array used to keep track of actual hierarchy levels, when those are being preserved.

subHeadings
An array used to keep track of adjusted, gradual headings, when gradual nesting is used.

Configurable

yes
Default implementation: fluid.tableOfContents.modelBuilder.gradualModelLevelFn

Notes

The Model Builder also defines an alternative implementation: fluid.tableOfContents.modelBuilder.skippedModelLevelFn, which produces a hierarchy that exactly reflects heading levels.

toModel

Div
classapi-table

Description

Used by the Model Builder to convert a flat list of headings into a hierarchical list using modelLevelFn.

Parameters

headingInfo
A flat array of objects describing all headings to be included in the table of contents

modelLevelFn
The function to use to determine the nesting of the table of contents.

Configurable

yes
Default implementation: "fluid.tableOfContents.modelBuilder.toModel".

See also

#modelLevelFn

Subcomponents

Subcomponents can be configured though the parent component's components option using the following pattern:

Code Block
javascript
javascript
parent.component.name(".myContainer", {
    components: {
        <subcomponentName>: {
            options: {
                <subcomponent options>
            }
        }
    }
});

headingCalculator

Div
classapi-table

Description

The headingCalculator subcomponent calculates and returns the heading level.

Default implementation

fluid.tableOfContents.levelsmodelBuilder.headingCalculator