ExtJS FormPanel 更改元素名称
我有一个 FormPanel,其中包含在创建时添加的复选框树。现在我想更改面板内所有复选框的通用名称模式。根据 DOM,名称已正确更改,但当我提交表单时,仍提交旧名称。尝试调用 .doLayout 但没有任何运气。有什么想法吗?
changePredicateName: function (panel, predicateName) {
var ref = this;
this.counter = 0;
panel.cascade(function (o) {
var name = ref.groupId + "." + predicateName + "." + ref.counter + "_value";
if (o instanceofnExt.form.Checkbox) {
o.name = name;
ref.counter++;
} else if (o.titleCheckbox) {
o.titleCheckbox.name = name;
ref.counter++;
}
return true;
});
panel.doLayout();
},
I have a FormPanel with a tree of checkboxes wich are added on creation. Now i want to change the general name pattern of all checkboxes inside the panel. According to the DOM the names are changed correctly but when i submit the form still the old names are submitted. Tried calling .doLayout but without any luck. Any ideas?
changePredicateName: function (panel, predicateName) {
var ref = this;
this.counter = 0;
panel.cascade(function (o) {
var name = ref.groupId + "." + predicateName + "." + ref.counter + "_value";
if (o instanceofnExt.form.Checkbox) {
o.name = name;
ref.counter++;
} else if (o.titleCheckbox) {
o.titleCheckbox.name = name;
ref.counter++;
}
return true;
});
panel.doLayout();
},
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
doLayout 仅调整对象大小/重新排列对象;它不会更改元素的名称等属性。为了更改您创建的元素的名称,您需要执行一些 DOM 操作,如下所示(假设
o
是一个 Ext.Element):doLayout only resizes / rearranges objects; it does not change properties such as the name of an element. In order to change the names of the elements you've created, you'll need to do some DOM manipulation like the following (Assuming
o
is an Ext.Element):