PDA

View Full Version : FormBind without controller refs



env0ke
27 Jan 2012, 3:42 AM
Hi,

Now i use controller refs for formbind in my forms. In refs i observe on validitychange for form and change disabled future for button:


'IncidentSearch > form':{
validitychange:function (form, isValid) {
if (isValid) {
this.getSearchButton().setDisabled(false);
} else {
this.getSearchButton().setDisabled(true);
}
}
}


But with 3-4 forms i have large refs code in controller. How can i use this in form/window code? How i can user relative path for button (not Ext.GetCmp) in window/form code? Sorry of my English :( .

friend
27 Jan 2012, 6:49 AM
From any point in your code, you can do things like this:


var button = Ext.ComponentQuery.query('IncidentSearch')[0].down('button[action="addIncident"]')

This assumes that you're buttons have an action property with some unique String value.