不显示远程查询的 Extjs 4.0 组合框。下拉值显示空白描述
Extjs 4.0 Combo box for a remote query not displaying. The Drop down values show blank description
我正在尝试从 Extjs 3.4 升级到 Extjs 4.0
initComponent: function() {
this.items = [{
xtype: 'fieldset',
width: 600,
bodyPadding: 40,
title: 'Dates',
items: [{
xtype: 'datefield',
anchor: '100%',
fieldLabel: 'From',
name: 'from_date',
format: 'm d Y',
value: '02 04 1978'
}, {
xtype: 'datefield',
anchor: '100%',
fieldLabel: 'To',
name: 'to_date',
format: 'm d Y',
altFormats: 'm,d,Y|m.d.Y',
value: '02.04.1978'
},{
xtype: 'combobox',
hiddenName: 'status',
fieldLabel: 'Status',
store: autoCompleteStore,
queryMode: 'remote',
forceSelection:'true',
triggerAction:'all',
displayField:'displayField',
fireEventOnSetValue: false,
valueField:'valueField',
emptyText:'Select one'
}]
}]
}
Ext.define("test.Tickler",{
extend: 'Ext.data.Model',
fields: [
{name: 'f_uid', type: 'string'},
{name: 'f_description', type: 'string'},
{name: 'f_value', type: 'string'},
{name: 'f_visible', type: 'string'},
{name: 'f_order', type: 'string'},
{name: 'f_default', type: 'string'},
]
});
var autoCompleteStore = new Ext.data.JsonStore({
model: "test.Tickler",
proxy:{
type: 'ajax',
url: '../medit_2_public/fc.php?_C_A=TicklerReport.getListOfTicklerReasons',
reader: new Ext.data.JsonReader({
type: 'json',
root: 'results.rows',
metaProperty: 'metaData'
})
}
}
});
这是我的元数据输出:
[,...]
0: {f_uid: "1", f_description: "需要表格", f_value: "1", f_visible: "Y", f_order: "1", f_default: "N"}
1: {f_uid: "3", f_description: "呼叫客户", f_value: "2", f_visible: "Y", f_order: "2", f_default: "N"}
当我的屏幕呈现时,我确实在状态下拉列表的值中看到了 Select 一个。当我 select 下拉菜单时,我确实看到了加载警告,并且在加载后看到了几个空白。
在您的 combobox
定义中,您必须设置数据中的哪些字段应在组合框中用作 值和显示字段 。目前您设置的字段名称在您的模型中不存在。例如这样设置:
valueField: 'f_value',
displayField: 'f_description'
我正在尝试从 Extjs 3.4 升级到 Extjs 4.0
initComponent: function() {
this.items = [{
xtype: 'fieldset',
width: 600,
bodyPadding: 40,
title: 'Dates',
items: [{
xtype: 'datefield',
anchor: '100%',
fieldLabel: 'From',
name: 'from_date',
format: 'm d Y',
value: '02 04 1978'
}, {
xtype: 'datefield',
anchor: '100%',
fieldLabel: 'To',
name: 'to_date',
format: 'm d Y',
altFormats: 'm,d,Y|m.d.Y',
value: '02.04.1978'
},{
xtype: 'combobox',
hiddenName: 'status',
fieldLabel: 'Status',
store: autoCompleteStore,
queryMode: 'remote',
forceSelection:'true',
triggerAction:'all',
displayField:'displayField',
fireEventOnSetValue: false,
valueField:'valueField',
emptyText:'Select one'
}]
}]
}
Ext.define("test.Tickler",{
extend: 'Ext.data.Model',
fields: [
{name: 'f_uid', type: 'string'},
{name: 'f_description', type: 'string'},
{name: 'f_value', type: 'string'},
{name: 'f_visible', type: 'string'},
{name: 'f_order', type: 'string'},
{name: 'f_default', type: 'string'},
]
});
var autoCompleteStore = new Ext.data.JsonStore({
model: "test.Tickler",
proxy:{
type: 'ajax',
url: '../medit_2_public/fc.php?_C_A=TicklerReport.getListOfTicklerReasons',
reader: new Ext.data.JsonReader({
type: 'json',
root: 'results.rows',
metaProperty: 'metaData'
})
}
}
});
这是我的元数据输出: [,...] 0: {f_uid: "1", f_description: "需要表格", f_value: "1", f_visible: "Y", f_order: "1", f_default: "N"} 1: {f_uid: "3", f_description: "呼叫客户", f_value: "2", f_visible: "Y", f_order: "2", f_default: "N"}
当我的屏幕呈现时,我确实在状态下拉列表的值中看到了 Select 一个。当我 select 下拉菜单时,我确实看到了加载警告,并且在加载后看到了几个空白。
在您的 combobox
定义中,您必须设置数据中的哪些字段应在组合框中用作 值和显示字段 。目前您设置的字段名称在您的模型中不存在。例如这样设置:
valueField: 'f_value',
displayField: 'f_description'