对于一些奇怪的原因,我无法为一个绑定值字段集与checkboxToggle属性设置为true.所以,它的配置如下:
xtype: "fieldset",
title: "Box",
checkboxName: "bounding_box",
checkboxToggle: true,
bind: {
collapsed: "{!rec.bounding_box}"
} // results in error message: TypeError: this[c._config.names.set] is not a function
// bind: "{!rec.bounding_box}" does not work either
Run Code Online (Sandbox Code Playgroud)
所以,上面的代码不起作用.但是,同样的技术适用于简单的checkbox字段:
xtype: "checkbox",
fieldLabel: "Show label",
name: "show_label",
bind: "{rec.show_label}"
Run Code Online (Sandbox Code Playgroud)
这有什么问题,我该如何解决?
如果您在调试版本中运行,则会收到一条错误消息,指出它无法绑定,因为fieldset上没有setCollapsed方法.你可以很容易地添加它:
Ext.define('AddSetCollapsed', {
override: 'Ext.form.FieldSet',
setCollapsed: function(collapsed) {
if (collapsed) {
this.collapse();
} else {
this.expand();
}
}
});
Run Code Online (Sandbox Code Playgroud)