SpreadJS 14
Getting Started / Object Inheritance
In This Topic
    Object Inheritance
    In This Topic

    For the objects in the SpreadJS widget, such as the sheet, column, and cell, there are formatting and other properties that each object inherits from what is called its "parent." A cell may inherit some formatting, for example, the background color from the sheet. If you set the alignment of text for all the cells in a column, the cell inherits that as well. Because of this object parentage, many properties and methods can be applied in different ways to different parts of a widget.

    You can override the formatting that an individual cell inherits, but by default, objects inherit properties from their parents. So in a given context, the settings of any object are the composite of the settings of its parents that are being applied to that object. For example, you might set the text color for a cell at the cell level, but it might inherit the vertical alignment from the row and the border from its column and the background color from the sheet. Since the background color might be set at several of these levels, certain rules of precedence must apply.

    The closer to the cell level, the higher the precedence. So if you set the background color of the cell, the settings inherited from the parents are overridden. Refer to the list to see the order of precedence of these properties. The closer to the cell (the lower the number) the higher the precedence.

    1. Cell
    2. Row
    3. Column
    4. Sheet

    See Also