Friday, February 7, 2014

React to a change in a dropdown list in dojox!

init: function(current, data) {
   var self = this;
   dojo.addOnLoad( function() {
      dojo.connect(dom.byId('locale'), "onchange", function(evt) {
         alert(self.locale.value);
         dojo.stopEvent(evt);
      });
   });
},

 
 

In order for the above to work in a dojox controller...

  1. One must have dojo/dom in the define signature of the AMD module.
  2. One must have "locale" as the value for both the id and the data-dojo-attach-point settings on a select tag like so:
    <select data-dojo-attach-point="locale" id="locale">

No comments:

Post a Comment