gpt4 book ai didi

javascript - ExtJS 4 组合框在表单绑定(bind)上显示 valueField 而不是 displayField

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:37:28 25 4
gpt4 key购买 nike

我在绑定(bind)到模型的表单中得到了一个 extjs 4 组合框。我使用 form.loadRecord(record) 将数据从网格绑定(bind)到组合。组合框显示来自分配给表单的模型的 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 "";
}
},

感谢您的帮助!

最佳答案

问题是我没有在模型中配置正确的类型。在模型中设置正确的类型解决了这个问题。感谢 sha 的帮助!

关于javascript - ExtJS 4 组合框在表单绑定(bind)上显示 valueField 而不是 displayField,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10404537/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com