Skip to content

Instantly share code, notes, and snippets.

@Kalyse
Created April 13, 2011 15:08
Show Gist options
  • Save Kalyse/917703 to your computer and use it in GitHub Desktop.
Save Kalyse/917703 to your computer and use it in GitHub Desktop.
Allow NumberTextBox to accept focus on a Enhanced Data Grid
formatCurrency: function(value, idx,e){
if(!this._widgets[e.field][idx]){
this._widgets[e.field][idx] = new dijit.form.NumberTextBox(
{ value: value,
'class': 'ratesNumber',
constraints: {pattern:"#,###,###.00"
}
});
this._widgets[e.field][idx].delay = 70;
this._widgets[e.field][idx].focusThrottle = function(node){
return dojo.hitch(this, function() {
if (this.executionTimer) {
clearTimeout(this.executionTimer);
}
this.executionTimer = setTimeout(dojo.hitch(this,function() {
console.log("Throttling complete");
dojox.grid.util.fire(node,"focus");
}), this.delay);
})();
}
if(!this._widgets[e.field][idx]._connection){
this._widgets[e.field][idx]._connection = dojo.connect(this._widgets[e.field][idx], "onFocus", function(e,f,g){
console.log("Focusing Connection");
setTimeout(dojo.hitch(this,function(){
this.focusThrottle(this);
}),0);
} );
}
}
return this._widgets[e.field][idx];
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment