API Docs for: 3.18.1

WidgetStdMod Class

Widget extension, which can be used to add Standard Module support to the base Widget class, through the Base.build method.

The extension adds header, body and footer sections to the Widget's content box and provides the corresponding methods and attributes to modify the contents of these sections.

Item Index

Properties

Methods

fillHeight

(
  • node
)

Sets the height on the provided header, body or footer element to fill out the height of the Widget. It determines the height of the widgets bounding box, based on it's configured height value, and sets the height of the provided section to fill out any space remaining after the other standard module section heights have been accounted for.

NOTE: This method is not designed to work if an explicit height has not been set on the Widget, since for an "auto" height Widget, the heights of the header/body/footer will drive the height of the Widget.

Parameters:

  • node Node

    The node which should be resized to fill out the height of the Widget bounding box. Should be a standard module section node which belongs to the widget.

getStdModNode

(
  • section
  • forceCreate
)
Node

Returns the node reference for the specified section.

Note: The DOM is not queried for the node reference. The reference stored by the widget instance is returned if it was set. Passing a truthy for forceCreate will create the section node if it does not already exist.

Parameters:

  • section String

    The section whose node reference is required. Either WidgetStdMod.HEADER, WidgetStdMod.BODY, or WidgetStdMod.FOOTER.

  • forceCreate Boolean

    Whether the section node should be created if it does not already exist.

Returns:

Node:

The node reference for the section, or null if not set.

setStdModContent

(
  • section
  • content
  • where
)

Updates the body section of the standard module with the content provided (either an HTML string, or node reference).

This method can be used instead of the corresponding section content attribute if you'd like to retain the current content of the section, and insert content before or after it, by specifying the where argument.

Parameters:

  • section String

    The standard module section whose content is to be updated. Either WidgetStdMod.HEADER, WidgetStdMod.BODY or WidgetStdMod.FOOTER.

  • content String | Node

    The content to be added, either an HTML string or a Node reference.

  • where String

    Optional. Either WidgetStdMod.AFTER, WidgetStdMod.BEFORE or WidgetStdMod.REPLACE. If not provided, the content will replace existing content in the section.

Properties

AFTER

String static

Constant used to specify insertion position, when adding content to sections of the standard module in methods which expect a "where" argument.

Inserts new content before the sections existing content.

ATTRS

Object static

Static property used to define the default attribute configuration introduced by WidgetStdMod.

BEFORE

String static

Constant used to specify insertion position, when adding content to sections of the standard module in methods which expect a "where" argument.

Inserts new content before the sections existing content.

BODY

String static

Constant used to refer the the standard module body, in methods which expect a section specifier

HEADER

String static

Constant used to refer the the standard module header, in methods which expect a section specifier

HTML_PARSER

Object static

The HTML parsing rules for the WidgetStdMod class.

REPLACE

String static

Constant used to specify insertion position, when adding content to sections of the standard module in methods which expect a "where" argument.

Replaces the sections existing content, with new content.

SECTION_CLASS_NAMES

Object static

Static hash of default class names used for the header, body and footer sections of the standard module, keyed by the section identifier (WidgetStdMod.STD_HEADER, WidgetStdMod.STD_BODY, WidgetStdMod.STD_FOOTER)

TEMPLATES

Object static

The template HTML strings for each of the standard module sections. Section entries are keyed by the section constants, WidgetStdMod.HEADER, WidgetStdMod.BODY, WidgetStdMod.FOOTER, and contain the HTML to be added for each section. e.g.

   {
      header : '<div class="yui-widget-hd"></div>',
      body : '<div class="yui-widget-bd"></div>',
      footer : '<div class="yui-widget-ft"></div>'
   }

Attributes

bodyContent

HTML

The content to be added to the body section. This will replace any existing content in the body. If you want to append, or insert new content, use the setStdModContent method.

Default: undefined

Fires event bodyContentChange

Fires when the value for the configuration attribute bodyContent is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:

  • e EventFacade
    An Event Facade object with the following attribute-specific properties added:
    • prevVal Any
      The value of the attribute, prior to it being set.
    • newVal Any
      The value the attribute is to be set to.
    • attrName String
      The name of the attribute being set.
    • subAttrName String
      If setting a property within the attribute's value, the name of the sub-attribute property being set.

fillHeight

String

The section (WidgetStdMod.HEADER, WidgetStdMod.BODY or WidgetStdMod.FOOTER) which should be resized to fill the height of the standard module, when a height is set on the Widget. If a height is not set on the widget, then all sections are sized based on their content.

Default: WidgetStdMod.BODY

Fires event fillHeightChange

Fires when the value for the configuration attribute fillHeight is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:

  • e EventFacade
    An Event Facade object with the following attribute-specific properties added:
    • prevVal Any
      The value of the attribute, prior to it being set.
    • newVal Any
      The value the attribute is to be set to.
    • attrName String
      The name of the attribute being set.
    • subAttrName String
      If setting a property within the attribute's value, the name of the sub-attribute property being set.

footerContent

HTML

The content to be added to the footer section. This will replace any existing content in the footer. If you want to append, or insert new content, use the setStdModContent method.

Default: undefined

Fires event footerContentChange

Fires when the value for the configuration attribute footerContent is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:

  • e EventFacade
    An Event Facade object with the following attribute-specific properties added:
    • prevVal Any
      The value of the attribute, prior to it being set.
    • newVal Any
      The value the attribute is to be set to.
    • attrName String
      The name of the attribute being set.
    • subAttrName String
      If setting a property within the attribute's value, the name of the sub-attribute property being set.

headerContent

HTML

The content to be added to the header section. This will replace any existing content in the header. If you want to append, or insert new content, use the setStdModContent method.

Default: undefined

Fires event headerContentChange

Fires when the value for the configuration attribute headerContent is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:

  • e EventFacade
    An Event Facade object with the following attribute-specific properties added:
    • prevVal Any
      The value of the attribute, prior to it being set.
    • newVal Any
      The value the attribute is to be set to.
    • attrName String
      The name of the attribute being set.
    • subAttrName String
      If setting a property within the attribute's value, the name of the sub-attribute property being set.