extjs中bind_ExtJS:Simple Form忽略formBind

I have a tiny problem that is driving me crazy for days. I have a form panel:

Ext.define('EC.view.PasswordPanel', {

extend: 'Ext.form.Panel',

alias: 'widget.pwdpanel',

bodyPadding: 15,

initComponent: function() {

this.initialConfig = {url:'/password/'};

this.fieldDefaults = {

labelAlign: 'right',

labelWidth: 135,

msgTarget: 'side',

allowBlank: false,

inputType: 'password'

};

//this.listeners = {

circumvent broken formBind

//validitychange: function(comp, valid) {

//this.down('button').setDisabled(!valid);

//}};

this.buttons = [{

text: 'Change',

formBind: true,

scope: this,

handler: function() {

this.submit({

success: function(form, action) {

Ext.Msg.alert(

'Success',

'

Password change has been scheduled successfully.

' +

EC.DELAY_NOTICE);

form.reset();

},

failure: function(form, action) {

if ('result' in action &&

'msg' in action.result) {

Ext.Msg.alert('Error', action.result.msg);

}

}

});

}

}];

this.items = [ {

xtype: 'textfield',

name: 'pw_old',

fieldLabel: 'Old password'

}, {

xtype: 'textfield',

name: 'pw_new1',

id: 'pw_new1',

fieldLabel: 'New password',

minLength: 8,

maxLength: 16

}, {

xtype: 'textfield',

name: 'pw_new2',

fieldLabel: 'Confirm new password',

} ];

this.callParent(arguments);

}

});

which I instantiate a tab from within a TabPanel:

{

title: 'Change Password',

items: { xtype: 'pwdpanel' },

},

Now, the validation works perfectly fine, but the "Change" button isn't disabled while the form isn't valid. To be clear: When I press it, it doesn't submit, yet I feel it should be disabled?

Am I doing something obvious wrong? Another form panel in a second tab works just fine.

I can circumvent the problem using the listener I commented out, but I understand that it should work w/o.

P.S. Feel free to point out any stupidities/bad style, I'm totally new to ExtJS.

解决方案

It's clear bug of extjs because even their own example works the same.

However, I've found quick workaround - add to initComponent lines:

this.on('afterrender', function(me) {

delete me.form._boundItems;

});

Here is fiddle.

UPDATE

The bug is fixed in 4.0.7.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值