Reputation: 69
I'm new with ExtJS.
I want to show an edit form which need a combobox component linked to remote datastore (category datastore) like this :
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'
}]
});
But, On this line :
model: 'AccountingApp.model.AccAccountCategory',
I got the error message :
Uncaught Error: No such Entity "AccountingApp.model.AccAccountCategory".
I tried to change the model to model: 'AccAccountCategory',
but the error was same.
Can you tell me what's wrong with the code ?
Upvotes: 2
Views: 3837
Reputation: 68
Your answer depends on what architecture your program uses.
First: you must require your model.
requires: [
'Ext.window.Window',
'AccountingApp.model.AccAccountCategory'
],
Second: In this pattern you must create your model with this code, as an item in the store's config:
model: Ext.create('AccountingApp.model.AccAccountCategory'),
Upvotes: 2