UIZE JavaScript Framework

MODULES Uize.Widget.mChildBindings

1. Introduction

The Uize.Widget.mChildBindings mixin implements features to provide a declarative approach to binding the state properties of a widget to those of its children.

DEVELOPERS: Ben Ilegbodu, original code contributed by Zazzle Inc.

1.1. Examples

There are no dedicated showcase example pages for the Uize.Widget.mChildBindings module.

SEARCH FOR EXAMPLES

Use the link below to search for example pages on the UIZE Web site that reference the Uize.Widget.mChildBindings module...

SEARCH

1.2. Implementation Info

The Uize.Widget.mChildBindings module defines the Uize.Widget.mChildBindings object under the Uize.Widget namespace.

1.2.1. Features Introduced in This Module

The features listed in this section have been introduced in this module.

STATIC PROPERTIES

Uize.Widget.mChildBindings.moduleName | Uize.Widget.mChildBindings.pathToResources

1.2.2. Features Overridden in This Module

No features have been overridden in this module.

1.2.3. Features Inherited From Other Modules

This module has no inherited features.

1.2.4. Modules Directly Under This Namespace

There are no modules directly under this namespace.

1.2.5. Unit Tests

There is no dedicated unit tests module for the Uize.Widget.mChildBindings module.

2. Static Methods

2.1. Uize.Widget.mChildBindings.childBindings

.

SYNTAX

MyWidgetClass.childBindings (bindingsOBJ);

VERBOSE EXAMPLE

MyNamespace.MyWidgetClass = Uize.Widget.mChildBindings.subclass ({
  childBindings:{
    size:{
      child:'sizeWidget',
      property:'value',
      direction:'<->' // bi-directional changes (default),
      valueAdapter:{
        aToB:function(value) { return value * value },
        bToA:function(value) { return Math.sqrt(value) }
      }
    },
    value:[ // parent-to-many-children
      {
        child:'valueWidget',
        direction:'->',
        valueAdapter:{
          aToB:'value * value' // via Uize.resolveValueTransformer
        }
      },
      {
        child:'valueWidget2',
        direction:'<-',
        valueAdapter:{
          bToA:'Math.sqrt(value)' // via Uize.resolveValueTransformer
        }
      }
    ]
  }
});

SHORT-HAND EXAMPLE

MyNamespace.MyWidgetClass = Uize.Widget.mChildBindings.subclass ({
  childBindings:{
    size:'<->sizeWidget.value',  // bi-directional changes with "value" state proprety in "sizeWidget" child
    value:[ // parent-to-many-children
      '->valueWidget', // changes to child only
      '<-valueWidget2' // changes from child only
    ],
    values:'valuesWidget' // bi-directional changes with same-named state proprety in "valuesWidget" child
  }
});

3. Static Properties

3.1. Uize.Widget.mChildBindings.moduleName

IMPLEMENTATION INFO

this feature was introduced in this module

3.2. Uize.Widget.mChildBindings.pathToResources

IMPLEMENTATION INFO

this feature was introduced in this module