ExtJS组合元素不显示
我的组合元素未显示。我正在使用本博客中描述的内联存储: 但我看到的只是一个像素高的空白空间,元素应该在这里渲染 小提琴在这里: 您没有使用“该博客中描述的内联存储” “该博客中描述的内联存储”如下所示:ExtJS组合元素不显示,extjs,Extjs,我的组合元素未显示。我正在使用本博客中描述的内联存储: 但我看到的只是一个像素高的空白空间,元素应该在这里渲染 小提琴在这里: 您没有使用“该博客中描述的内联存储” “该博客中描述的内联存储”如下所示: items: [ { xtype: 'combobox', store: [ 'Red', 'Yellow',
items: [
{
xtype: 'combobox',
store: [
'Red',
'Yellow',
'Green'
],
maxLength: 64
}
]
items: [
{
xtype: 'combobox',
store: Ext.create('Ext.data.Store', {
fields: ['name'],
data: [
{name: 'Red'},
{name: 'Yellow'},
{name: 'Green'} ]
}),
maxLength: 64
}
]
或者像这样:
items: [
{
xtype: 'combobox',
store: [
'Red',
'Yellow',
'Green'
],
maxLength: 64
}
]
items: [
{
xtype: 'combobox',
store: Ext.create('Ext.data.Store', {
fields: ['name'],
data: [
{name: 'Red'},
{name: 'Yellow'},
{name: 'Green'} ]
}),
maxLength: 64
}
]
但我必须承认,当ExtJS开发人员选择不允许您尝试的那种声明时,他们没有考虑足够多。但是为了实现这一点,存储需要一个xtype或类似的配置选项,因为在您定义它时,不清楚您选择了哪种类型的存储—Ajax存储、JsonP存储、Direct存储、store
但这种配置选项在Ext中不可用;因此,必须创建或定义存储。将
显示字段:'name'
添加到组合配置中,它应该如下所示
{
xtype: 'combobox',
displayField:'name', //the name of the field you want to display on the combo
store: {
fields: ['name'],
data: [
{name: 'Red'},
{name: 'Yellow'},
{name: 'Green'}
]},
maxLength: 64
}
您可能也想设置valueField,但我将把它留给您如果您查看第二部分,他将在