combobox不在extjs 4 mvc环境中运行?
我正在尝试运行一个组合框,但是当我将它添加到表单中时,表单不会显示 以下是我的表单代码:combobox不在extjs 4 mvc环境中运行?,extjs,sencha-touch,extjs4,sencha-touch-2,Extjs,Sencha Touch,Extjs4,Sencha Touch 2,我正在尝试运行一个组合框,但是当我将它添加到表单中时,表单不会显示 以下是我的表单代码: Ext.define("Screener.view.Pharmacyform", { xtype: 'pharmacyform', extend: 'Ext.form.Panel', requires: ['Ext.tab.Panel','Ext.form.FieldSet'], config:{ styleHtmlContent:
Ext.define("Screener.view.Pharmacyform", {
xtype: 'pharmacyform',
extend: 'Ext.form.Panel',
requires: ['Ext.tab.Panel','Ext.form.FieldSet'],
config:{
styleHtmlContent: true,
xtype:'orderform',
autoscroll: true,
items:[{
xtype: 'fieldset',
title: 'Pharmacy Order',
items: [
{
xtype: 'textfield',
name : 'name',
label: 'Name'
},{
{xtype: 'combo',
fieldLabel: 'Combobox',
name:'drugdrug',
id:'combodrug',
store: Ext.create('Screener.store.Drugs',{
storeId: 'drugstore'
}),
displayField: 'drugname',
valueField: 'drugname',
queryMode: 'local',
triggerAction: 'all'
}
]
}]
}
});
药店代码:
/*
* This store loads the drugs from file 'drugs.json'
* Note: there is no writer attached, so changes will
* only occur in local cache
*/
Ext.define('Screener.store.Drugs', {
extend: 'Ext.data.Store',
storeId: 'drugStore',
config: {
model: 'Screener.model.Drug',
proxy: {
type: 'ajax',
url : 'drugs.json',
reader: 'json',
},
autoLoad: true
}
});
我是extjs新手,请告诉我如何让它工作您没有指定太多。为了能够帮助您,我需要一个工作样本和您正在使用的sencha版本 从表面上看,您有两个存储:第一个存储在组合框定义中定义为“inline”。该存储不是Ext.store.store的后代,因此无法工作 第二个似乎几乎是正确的,但由于您正在实例化第一个,所以没有使用它 尝试将视图中的商店定义更改为:
...
fieldLabel: 'Combobox',
name:'drugdrug',
id:'combodrug',
store: 'drugStore'
...
此外,您并不是说控制台中是否出现错误。问题在于您正在按名称引用存储,并且需要在加载视图之前加载该存储。您有三种选择: 引用此视图的控制器中的存储。存储[],并在视图之前加载控制器 在应用程序中引用存储。存储[] 通过引用而不是名称设置存储,例如:
{
xtype:'combobox',
store: new Ext.data.Store({model:'somemodel'}),
...
}
最后一个选项可能更好,因为组合通常在自己的商店中工作得更好。例如,在4.1RC2中有一个错误,您无法使用共享存储的分页。在这种情况下,请确保将代理放在模型上,以便同一模型的存储之间没有代码重复。嘿,伙计,您应该添加一条语句
renderTo:Ext.getBody好的,我已经尝试过了,但仍然面临同样的问题,我在主面板上创建了三个按钮,单击其中一个按钮打开表单,但在添加组合框时不会出现这种情况,但是其他按钮工作正常,当我尝试在requires[]中添加Ext.form.field.ComboBox时,应用程序不会加载。,api中的combobox类是否有问题?使用firefox。安装firebug。firebug中有错误吗?谢谢