[Dojo-interest] hooking up to onChange generically

V S P toreason at fastmail.fm
Wed Aug 27 19:08:44 UTC 2008


Hi,

I have a class where I would like to handle
all the onchange events from a subset of my
dijit controls.


However, I cannot figure out while within the
handler -- what dijit fired it.

All of the controls that I want to setup like this
are derivatives of _FormWidget (except DataGrid, which
I plan to handle separately)


Another thing I cannot figure out is how to 'parse'
out the argument to onChange correctly.  I have noticed for example
that in most instances it is a 'string' object --
but I cannot see it for sure in Firebug.  
Is there a standard for what's passed as the Arg to onchange,
or does it differ from control to control?

And the thid question:  I noticed that onChange fires
also the first time I populate the control with data
(using d.attr('value',data) )
(I am using pre 1.2 SVN trunk)
Is that a normal behaviour, and if yes -- is there a way
for me to know that this particular onChange is for
the first time setting the value from within 'attr' function call
(vs user actually changing something)





Here is the example:


dojo.declare(
	"cElemModel" ,
	null,
{
	
constructor: function (ctrl_id)
{
  var d=dijit.byId(ctrl_id);
  if (d===false || d===null)
                   throw ("error");
 dojo.connect ,"onChange",this,"onChange_dojo");                        
                 }       
},
onChange_dojo: function(arg)
{
 console.dir(this);
 console.debug(arg);
}
});


thanks in advance,
Vlad
-- 
  V S P
  toreason at fastmail.fm

-- 
http://www.fastmail.fm - Accessible with your email software
                          or over the web



More information about the Dojo-interest mailing list