when using stateful object in dojox/mvc package, declarative examples seems have target model in global namespace (defined without "var" keyword). violates general practices of javascript design polluting global namespace, not mention making use of different models difficult , messy.
my question is, what's scope of declarative at() , how 1 use model lies inside context/scope?
http://dojotoolkit.org/reference-guide/1.9/dojox/mvc.html#id6
where dojox/mvc/at api typically used in data-dojo-props. 3 things comes mind talking setting "scope" there:
- running dojo parser
parser.parse(rootnode, {propsthis: scopeobj});can makethisin data-dojo-props specified object. in waydata-dojo-props="widgetprop: at(this, 'scopeobjprop')"points property inscopeobj. - in widgets-in-template,
data-dojo-props="widgetprop: at(this, 'widgetsintemplateprop')"points property in widgets-in-template instance. relative data binding makes
targetproperty in widget in dom referred via "rel:" special syntax. setting objecttargetproperty there,registry.byid("scopewidget").set("target", {first: "john", last: "doe"});in below example, populate value in<input>:<script type="dojo/require">at: "dojox/mvc/at"</script> <div id="scopewidget" data-dojo-type="dijit/_widgetbase" data-dojo-props="target: {}"> <div> first: <input data-dojo-type="dijit/form/textbox" data-dojo-props="value: at('rel:', 'first')"> </div> <div> last: <input data-dojo-type="dijit/form/textbox" data-dojo-props="value: at('rel:', 'last')"> </div> </div>
hope helps.
best, akira
Comments
Post a Comment