【发布时间】:2016-05-27 03:35:20
【问题描述】:
我是 ExtJS 的新手。
我想显示一个编辑表单,它需要一个链接到远程数据存储(类别数据存储)的组合框组件,如下所示:
Ext.define('AccountingApp.view.content.accAccountSubCategory.Form', {
extend: 'Ext.window.Window',
xtype: 'accAccountSubCategoryForm',
requires: [
'Ext.window.Window',
],
bind: {
title: '{title}'
},
layout: 'fit',
modal: true,
width: 500,
height: 430,
closable: true,
constrain: true,
items: {
xtype: 'form',
reference: 'form',
bodyPadding: 10,
border: false,
modelValidation: true,
layout: {
type: 'vbox',
align: 'stretch'
},
items: [{
xtype: 'combobox',
reference: 'accaccountcategory',
publishes: 'value',
fieldLabel: 'Select Category',
displayField: 'account_category',
valueField: 'id',
anchor: '-15',
store: Ext.create('Ext.data.Store', {
proxy: {
type: 'ajax',
url: 'backend/accAccountCategory/combo',
reader: {
type: 'array',
rootProperty: 'data'
}
},
//the error is here
model: 'AccountingApp.model.AccAccountCategory',
autoLoad: true
}),
minChars: 0,
queryParam: 'q',
queryMode: 'remote',
}]
},
buttons: [{
text: 'Save',
handler: 'onSaveClick'
}, {
text: 'Cancel',
handler: 'onCancelClick'
}]
});
但是,在这一行:
model: 'AccountingApp.model.AccAccountCategory',
我收到了错误信息:
Uncaught Error: No such Entity "AccountingApp.model.AccAccountCategory".
我尝试将模型更改为model: 'AccAccountCategory',,但错误相同。
你能告诉我代码有什么问题吗?
【问题讨论】:
-
尝试了一些技巧,最后我发现我们可以根据我们的模型定义将
model: 'AccountingApp.model.AccAccountCategory',替换为fields: [ 'id', 'account_category' ],。但这个解决方案是暂时的,仍在等待最佳答案:)。 -
你没有展示最关键的部分。你在哪里声明了模型?