[dojo-contributors] MVC support for dijit based on dojo.Stateful

Rahul Akolkar rahul.akolkar at gmail.com
Wed Mar 9 12:31:56 EST 2011


Hi Bill,

Inline.

On Wed, Mar 9, 2011 at 4:50 AM, Bill Keese <bill at dojotoolkit.org> wrote:
>
>
>> > After that I want to take a look at when you are using "ref" as a
>> > string and when you are using it as an object.   I'm guessing it's
>> > always an
>> > object except when it's a value relative to a parent node, in which case
>> > it's a string.
>> >
>> <snap/>
>>
>> Right, thats how its treated. Its always specified as a string.
>
> Actually, "always specified as a string" is the opposite of what I said.
<snip/>

Thats why I put a period after the word treated (to separate agreement
from the next sentence).


> Here's your current code example:
>
>        <div class="row" data-dojo-type="dijit.mvc.Group"
> data-dojo-props="ref: 'model'">
>
>             <div class="row">
>
>                 <label class="cell" for="serialInput">Order #:</label>
>
>                 <input class="cell" id="serialInput"
> data-dojo-type="dijit.form.TextBox"
>
>                                     data-dojo-props="ref: 'Serial'"></input>
>
>             </div>
>
>             <div class="row">
>
>                 <label class="cell" for="lastnameInput">Last:</label>
>
>                 <input class="cell" id="lastnameInput"
> data-dojo-type="dijit.form.TextBox"
>
>                                     data-dojo-props="ref: 'Last'"></input>
>
>             </div>
>
>             <div class="row">
>
>                 <label class="cell" for="emailInput">Email:</label>
>
>                 <input class="cell" id="emailInput"
> data-dojo-type="dijit.form.TextBox"
>
>                                     data-dojo-props="ref: 'Email'"></input>
>
>             </div>
>
>         </div>
> It's depending on a global variable named model, right?   It's bad to depend
> on global variables; it's the opposite of the direction we are trying to go
> with the  AMD work.
<snap/>

The variable model is in the application space, i.e. it will commonly
be an application concern to set up the data model (how else would you
define an application-specific model). I don't see how this is at odds
with anything, let alone AMD work.

Lets not create one sweeping bucket for all global variables: some are
bad, others are great :-)


> What I expected was:
>
>
>   <div class="row" data-dojo-type="dijit.mvc.Group" data-dojo-props="ref:
> model">
>
> Eventually the parser will have a context/scope argument against which it
> will resolve variables like "model", allowing model to be a local variable.
>
<snip/>

There are many places where if there isn't a context supplied,
dojo.global is used. This isn't any different. The actual mechanics
may have something to do with the parser setting up context, or may
not.

As I said in my last note in $thread, let me take any magic out of the
ref specification in next patch (right now, its a function of the DOM)
but it will be a string, semantics to be interpreted by the data
binding mixin. Then lets look at some concrete examples again.

Cheers,
-Rahul


More information about the dojo-contributors mailing list