如何绑定fieldset值

时间:2016-07-17 14:37:56

标签: javascript extjs

由于某些奇怪的原因,我无法为fieldset绑定private void shareImage() { Intent share = new Intent(Intent.ACTION_SEND); // If you want to share a png image only, you can do: // setType("image/png"); OR for jpeg: setType("image/jpeg"); share.setType("image/*"); // Make sure you put example png image named myImage.png in your // directory String imagePath = Environment.getExternalStorageDirectory() + "/myImage.png"; File imageFileToShare = new File(imagePath); Uri uri = Uri.fromFile(imageFileToShare); share.putExtra(Intent.EXTRA_STREAM, uri); startActivity(Intent.createChooser(share, "Share Image!")); } 属性设置为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 字段时,同样的技术效果很好:

checkbox

这有什么问题,如何解决?

1 个答案:

答案 0 :(得分:5)

如果您在调试版本中运行,则会收到一条错误消息,指出它无法绑定,因为fieldset上没有setCollapsed方法。您可以非常轻松地添加它:

Ext.define('AddSetCollapsed', {
    override: 'Ext.form.FieldSet',

    setCollapsed: function(collapsed) {
        if (collapsed) { 
            this.collapse();
        } else {
            this.expand();
        }
    }
});