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.
Parameter | Type | Description |
---|---|---|
target | dojo/Stateful | String | dojo/Stateful to be synchronized. |
targetProp | String | The property name in target to be synchronized. |
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.
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>
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>
Data binding goes in both directions (dojox/mvc/Bind.from | dojox/mvc/Bind.to)
A handle of data binding target (a dojo/Stateful property), which is used for start synchronization with data binding source (another dojo/Stateful property).