dojox/mvc/at (version 1.10)

Summary

Returns a pointer to data binding target (a dojo/Stateful property), called at handle, which is used for start synchronization with data binding source (another dojo/Stateful property).

Typically used in data-dojo-props so that a widget can synchronize its attribute with another dojo/Stateful, like shown in the example.

Usage

at(target,targetProp);
Parameter Type Description
target dojo/Stateful | String

dojo/Stateful to be synchronized.

targetProp String

The property name in target to be synchronized.

Returns:any | dojox/mvc/at.handle

A pointer to data binding target (a dojo/Stateful property), called at handle, which is used for start synchronization with data binding source (another dojo/Stateful property).

See the dojox/mvc/at reference documentation for more information.

Examples

Example 1

Two seconds later, the text box changes from "Foo" to "Bar" as the "value" property in model changes.

<html>
    <head>
        <script src="/path/to/dojo-toolkit/dojo/dojo.js" type="text/javascript" data-dojo-config="parseOnLoad: 0"></script>
        <script type="text/javascript">
            require([
                "dojo/parser", "dojo/Stateful", "dijit/form/TextBox", "dojo/domReady!"
            ], function(parser, Stateful){
                model = new Stateful({value: "Foo"});
                setTimeout(function(){ model.set("value", "Bar"); }, 2000);
                parser.parse();
            });
        </script>
    </head>
    <body>
        <script type="dojo/require">at: "dojox/mvc/at"</script>
        <input type="text" data-dojo-type="dijit/form/TextBox" data-dojo-props="value: at(model, 'value')">
    </body>
</html>

Example 2

Edit in text box is reflected to the text next to it.

<html>
    <head>
        <script src="/path/to/dojo-toolkit/dojo/dojo.js" type="text/javascript" data-dojo-config="parseOnLoad: 0"></script>
        <script type="text/javascript">
            require([
                "dojo/parser", "dojo/Stateful", "dojo/domReady!"
            ], function(parser, Stateful){
                model = new Stateful({value: "Foo"});
                parser.parse();
            });
        </script>
    </head>
    <body>
        <script type="dojo/require">at: "dojox/mvc/at"</script>
        <input type="text" data-dojo-type="dijit/form/TextBox" data-dojo-props="value: at(model, 'value')">
        <span data-dojo-type="dijit/_WidgetBase" data-dojo-props="_setValueAttr: {node: 'domNode', type: 'innerText'}, value: at(model, 'value')"></span>
    </body>
</html>

Property Summary

  • bothData binding goes in both directions (dojox/mvc/Bind.from | dojox/mvc/Bind.to)
  • fromData binding goes from the source to the target
  • handleA handle of data binding target (a dojo/Stateful property), which is used for start synchronization with data binding source (another dojo/Stateful property).
  • toData binding goes from the target to the source

Method Summary

Properties

both
Defined by: dojox/mvc/sync

Data binding goes in both directions (dojox/mvc/Bind.from | dojox/mvc/Bind.to)

from
Defined by: dojox/mvc/sync

Data binding goes from the source to the target

handle
Defined by: dojox/mvc/at

A handle of data binding target (a dojo/Stateful property), which is used for start synchronization with data binding source (another dojo/Stateful property).

to
Defined by: dojox/mvc/sync

Data binding goes from the target to the source

Methods

Error in the documentation? Can’t find what you are looking for? Let us know!