开发者

ExtJs 3.3 - When is the exact moment Combobox value is setted?

开发者 https://www.devze.com 2023-04-05 11:27 出处:网络
I have a combobox populated by Json and a function to enable/disable a textfield based on the value selected in the combobox. I registered the listeners as follow:

I have a combobox populated by Json and a function to enable/disable a textfield based on the value selected in the combobox. I registered the listeners as follow:

var cmbTipoDocumento = Ext.getCmp("frmCandidato_cmbTipoDocumento");
cmbTipoDocumento.on('afterrender',selecionarTipoDocumento);
cmbTipoDocumento.on('select',selecionarTipoDocumento);
cmbTipoDocumento.on('blur',selecionarTipoDocumento);

That is working fine when I manually select an item in the combobox, but when the value is loaded with the form it doesn't work. For example, I have 3 items in the combobox: 'One', 'Other', 'Another'. When I select 'Another' I want to enable a textfield so that the user can specify a detail. When I select it by hand everything goes OK. But when I 开发者_运维百科open a record that has 'Another' selected in the combobox the textfield still disabled.

I've debugged the function and notice that it is called when the form is open (combobox afterrender), but at this moment the value of the combobox is empty. I've tried to call the function on the form's 'afterrender' event and on some other events, but the results are the same.

Any tip?

Thank you!


in javascript you use the 'change' event to detect when a value has been set:

maybe try:

cmbTipoDocumento.on('change',selecionarTipoDocumento);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号