No subject

Tue Jul 26 08:36:55 EDT 2011

to myGrid from the event object with the dgrid events.  I wonder if that
should be changed...

-- Tom

Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Inline.<br><br><div class=3D"gmail_quote">2012/2/1 Bill Keese <span dir=3D"=
ltr">&lt;<a href=3D"mailto:bill at">bill at</a>&g=
t;</span><br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;b=
order-left:1px #ccc solid;padding-left:1ex">
<div>It seems like your email is talking about both API and implementation.=
</div></blockquote><div><br></div><div>It is, and it&#39;s merely a suggest=
ion. =A0Don&#39;t have to follow it at all if you think it won&#39;t work f=
or Dijit =3D)</div>
<div>=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;=
border-left:1px #ccc solid;padding-left:1ex"><div></div>Regarding implement=
ation, you talk about decorating DOM events rather than creating new events=
. =A0 =A0But from the other emails, apparently if we want to be able to cat=
ch events on plain DOMNodes (and to support IE) then we need to use synthet=
ic events,=A0</blockquote>
<div>=A0</div><div>Right, but (as you mentioned in the next email), it look=
s like synthetic events are fairly easy to pull. =A0Keeping It Simple, Stup=
id and all that.</div><div><br></div><blockquote class=3D"gmail_quote" styl=
e=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div></div><div>However, the main thing for me is API. =A0 And are you sayi=
ng that you can call myGrid.on() to monitor events, and it apparently works=
 similarly, or the same as, monitoring events on myGrid.domNode or an ances=
tor DOMNode? =A0 I.E.:</div>
<div class=3D"im">

<div><br></div><blockquote style=3D"margin:0 0 0 40px;border:none;padding:0=
<div><div>myGrid.on(&quot;.dgrid-cell:click&quot;, function(evt){</div></di=
v><div><div>=A0 =A0 var cell =3D myGrid.cell(e); =A0// gets you a reference=
 to the cell clicked on in the grid</div></div><div><div>=A0 =A0 if(
lumn.field =3D=3D &quot;field&quot;)....</div>

iv><div><br></div><blockquote style=3D"margin:0 0 0 40px;border:none;paddin=
g:0px"><div><div>on(document.body, &quot;.dgrid-cell:click&quot;, function(=

</div><div><div>=A0 =A0 var cell =3D myGrid.cell(evt); =A0// gets you a ref=
erence to the cell clicked on in the grid</div></div><div class=3D"im"><div=
><div>=A0 =A0 if(cell.column.field =3D=3D &quot;field&quot;)....</div></div=

<div><br></div><div>This is interesting, although difficult from backwards-=
compatibility concerns, namely that callbacks registered via _WidgetBase.on=
(..., callback) typically have a different signature. =A0 =A0For example=A0=
_WidgetBase.on(&quot;change&quot;, func)=A0will call=A0func(newWidgetValue)=
 rather than=A0func(evt).</div>
</blockquote><div><br></div><div>This is also true but its a first step in =
evaluating whether or not this could be a valid approach for Dijit 2.0. =A0=
I don&#39;t see anything wrong with the idea of decorating an event object =
with something like evt.oldValue and evt.newValue, for instance.</div>
<div>=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;=
border-left:1px #ccc solid;padding-left:1ex"><div></div><div>The other thin=
g is about naming for the event type, that I had renamed click as WidgetCli=
ck, so in my prototype you would call</div>
<div><br></div><blockquote style=3D"margin:0 0 0 40px;border:none;padding:0=


myButton.on(&quot;click&quot;, callback)</div></blockquote><div><br></div><=
div>vs.</div><div><br></div><blockquote style=3D"margin:0 0 0 40px;border:n=
one;padding:0px"><div>on(document.body, &quot;.dijitButton:WidgetClick&quot=
;, callback)</div>

</blockquote><div><br></div><div>I suppose that if I keep the DOMNode event=
 types and widget event types separate, I could support _WidgetBase.on(&quo=
t;WidgetClick&quot;, func) where the func() callback gets passed an event o=
bj. =A0 That might be a good compromise.</div>
</blockquote><div><br></div><div>Absolutely; like you mentioned in the next=
 email, there shouldn&#39;t be anything wrong with the idea of using on.emi=
t to fire off custom events; the only thing I&#39;d probably say is that if=
 we were to go that route, it might not be a bad idea to create a fake even=
t object and pass all handlers that instead, i.e. { oldValue: foo, newValue=
: bar }...just a thought.=A0</div>
<div><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex=
;border-left:1px #ccc solid;padding-left:1ex"><div></div><div>
<div>BTW, I like the selector example of &quot;.dgrid-cell:click&quot; and =
the one from your subsequent email about &quot;.dijitTextBox:change&quot;. =
=A0 I had forgotten that widgets already have interesting classnames set vi=
a baseClass (ex: dijitTextBox for dijit/form/TextBox), and that apps can le=
verage them.</div>

<div><br></div><div>Also, in the above examples, I would hope that I can ge=
t the pointer to myGrid from the evt object somehow.</div></blockquote><div=
><br></div><div>From doing some quick inspecting, it looks like you don&#39=
;t get a reference to myGrid from the event object with the dgrid events. =
=A0I wonder if that should be changed...</div>
<div><br></div><div>-- Tom=A0</div></div>


More information about the dojo-contributors mailing list