微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javascript – ExtJS 4组合框在表单绑定上显示valueField而不是displayField

我在一个绑定到模型的表单中得到了一个extjs 4组合框.我使用form.loadRecord(record)将数据从网格绑定到组合.组合框显示的valueField来自分配给表单的模型而不是displayField.组合框的存储是预加载的.如何实现组合框显示displayValue在表单中加载记录?

        {xtype:'comboBox',
        fieldLabel: 'category',
        name: 'categorySelId',
        store: 'Categories',
        queryMode: 'local',
        displayField: 'label',
        valueField: 'id',
        anchor:'96%',
        loadMask: true,
        typeAhead: true,
        forceselection: true,
        valueNotFoundText: 'nothing found'}

商店已在网格中用于显示列类别

        { header: 'Category', dataIndex: 'categorySelectedId', flex:5,
            renderer: function(value,MetaData,record) {
                if(value) {
                    var Categories = Ext.getStore('Categories');
                    var catRecord = Categories.findRecord('id', value);
                    return catRecord ? catRecord.get('label'): record.get('categorySelected');
                } else return "";
            }
        },

谢谢你的帮助!

解决方法:

问题是我还没有在模型中配置正确的类型.在模型中设置正确的类型解决了问题. Thx sha帮忙!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐