如何解决ExtJs 3.4 在 xtype 中显示错误文本字段:'textfield' (MODx)
MyClass.window.Test = function (config) {
config = config || {};
Ext.applyIf(config,{
title: 'Test',width: '1000',autoHeight: true,fields: [
{
xtype: 'panel',items: [{
layout: 'form',items: [
{
xtype: 'textfield',name: 'testfield',fieldLabel: 'Test Label Textfield',id: 'testfield',emptyText: 'text',allowBlank: true,anchor:'95%'
}
]
},]}
],url: MyClass.config.connector_url,action: 'mgr/myext/create',});
MyClass.window.Test.superclass.constructor.call(this,config);
};
Ext.extend(MyClass.window.Test,MODx.Window);
Ext.reg('test-window',MyClass.window.Test,MODx.Window);
按钮本身是这样的
{
xtype: 'button',text: 'TEST',cls: 'primary-button',handler: function () {
MODx.load({
xtype: 'test-window',listeners: {
success: {
fn: function () {
this.refresh();
},scope: this
}
}
}).show();
}
}
问题。当我第一次单击按钮时,表单显示正确。当我第二次单击时,textfield 消失并且 fieldLabel 重复了 4 次 (1 click normall 2 click and more - crash)。 如果我用任何其他 xtype 替换文本字段 - 一切正常。如果删除 id 效果很好(!!!)。但我需要 Ext.getCmp 的 id。我不明白为什么第一次一切都很好,但是当我再次单击时,它没有正确显示。我在任何地方都找不到类似的问题,很沮丧。任何对 fieldlabel、layuot 属性的操作都无济于事。问题出在哪里?在工作版本中,我有大约 40 个文本字段。
解决方法
默认情况下窗口不会在关闭时销毁,因此您有两个具有相同 id 的元素再次创建窗口。
this.ident = config.ident || 'mywindow' + Ext.id();
在窗口代码开始后
config = config || {};
稍后使用
id: 'textfield' + this.ident
将有助于绕过这个问题。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。