# Yahoo! UI Library

### widget-child 3.3.0

Yahoo! UI Library > widget-child > WidgetChild
Search:
Filters Show Private Show Protected Show Deprecated

## Class WidgetChild

Widget extension providing functionality enabling a Widget to be a child of another Widget.

### Properties

#### ROOT_TYPE - `Object`

Constructor reference used to determine the root of a Widget-based object tree.

Currently used to control the behavior of the `root` attribute so that recursing up the object heirarchy can be constrained to a specific type of Widget. Widget authors should set this property to the constructor function for a given Widget implementation.

### Methods

#### _afterChildSelectedChange

`protected void _afterChildSelectedChange ( event )`
Default attribute change listener for the `selected` attribute, responsible for updating the UI, in response to attribute changes.

Parameters:
  `event <EventFacade>` The event facade for the attribute change.

#### _bindUIChild

`protected void _bindUIChild ( )`
Binds event listeners responsible for updating the UI state in response to WidgetChild related state changes.

This method is invoked after bindUI is invoked for the Widget class using YUI's aop infrastructure.

#### _syncUIChild

`protected void _syncUIChild ( )`
Synchronizes the UI to match the WidgetChild state.

This method is invoked after bindUI is invoked for the Widget class using YUI's aop infrastructure.

#### _uiSetChildSelected

`protected void _uiSetChildSelected ( selected )`
Updates the UI to reflect the `selected` attribute value.

Parameters:
  `selected <number>` The selected value to be reflected in the UI.

#### ancestor

`Widget ancestor ( depth )`
Returns the Widget instance at the specified depth.

Parameters:
  `depth <number>` Number representing the depth of the ancestor.

Returns: `Widget`
  Widget instance.

#### isRoot

`Boolean isRoot ( )`
Determines if the Widget is the root Widget in the object hierarchy.

Returns: `Boolean`
  Boolean indicating if Widget is the root Widget in the object hierarchy.

#### next

`Widget next ( circular )`
Returns the Widget's next sibling.

Parameters:
  `circular <Boolean>` Boolean indicating if the parent's first child should be returned if the child has no next sibling.

Returns: `Widget`
  Widget instance.

#### previous

`Widget previous ( circular )`
Returns the Widget's previous sibling.

Parameters:
  `circular <Boolean>` Boolean indicating if the parent's last child should be returned if the child has no previous sibling.

Returns: `Widget`
  Widget instance.

### Events

#### depthChange

`depthChange ( event )`
Fires when the value for the configuration attribute 'depth' 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:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### indexChange

`indexChange ( event )`
Fires when the value for the configuration attribute 'index' 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:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### parentChange

`parentChange ( event )`
Fires when the value for the configuration attribute 'parent' 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:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### rootChange

`rootChange ( event )`
Fires when the value for the configuration attribute 'root' 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:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### selectedChange

`selectedChange ( event )`
Fires when the value for the configuration attribute 'selected' 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:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

### Configuration Attributes

#### depth `- Number`

Number representing the depth of this Widget relative to the root Widget in the object heirarchy.
Default Value: -1

#### index `- Number`

Number representing the Widget's ordinal position in its parent Widget.

#### parent `- Widget`

Retrieves the parent of the Widget in the object hierarchy.

#### root `- Widget`

Returns the root Widget in the object hierarchy. If the ROOT_TYPE property is set, the search for the root Widget will be constrained to parent Widgets of the specified type.

#### selected `- Number`

Number indicating if the Widget is selected. Possible values are:

0
  (Default) Not selected
1
  Fully selected
2
  Partially selected

Default Value: 0

Copyright © 2011 Yahoo! Inc. All rights reserved.