PDA

View Full Version : inline data, store and model, does not correspond to a valid model



deathgod86
25 Dec 2013, 8:24 AM
Hi,

I am developing a testing / prototype using store and model for inline data.
However, I encounter the following error.
I already look for internet and sample for more than 6 hours still cant find my mistake.
Thanks in advance for any helps.



[W] TestERP.store.sales.Customer created with no model. The name 'framework.form.Combobox' does not correspond to a valid model.
TypeError: 'undefined' is not an object (evaluating 'me.model.getProxy')


Here is my prototype info.
OS: Windows 7
Browser: Safari 5.1.7
Sencha ExtJS 4.2.1.883
Project created using sencha cmd generate app.

Folder Hierarchy:


app
model
framework
form
Combobox.js
store
sales
Customer.js
view
sales
QuotationForm


Combobox model:


Ext.define('TestERP.model.framework.form.Combobox', {
extend: 'Ext.data.Model',

fields: [{
type: 'string', name: 'display'
}, {
type: 'string', name: 'value'
}]
});


Customer Store (Inline data):


Ext.define('TestERP.store.sales.Customer', {
extend: 'Ext.data.Store',

config: {
model: 'framework.form.Combobox',

data: [{
value: '1', display: 'AAA Company'
}, {
value: '2', display: 'BBB Company'
}, {
value: '3', display: 'CCC Company'
}, {
value: '4', display: 'DDD Company'
}, {
value: '---New---', display: 'New'
}]
}
});


Quotation Form:


Ext.define('TestERP.view.sales.QuotationForm', {
extend: 'Ext.FormPanel',
xtype: 'sales-QuotationForm',

layout: 'form',

collapsible: true,
id: 'QuotationForm',
url: '',
title: 'Quotation - New',

items: [{
xtype: 'combobox',
fieldLabel: 'Customer',
displayField: 'display',
valueField: 'value',
typeAhead: true,
queryMode: 'local',
store: 'sales-Customer'
}]
});


Application.js


Ext.define('TestERP.Application', {
name: 'TestERP',

extend: 'Ext.app.Application',

views: [
'framework.HeaderMenu',
'framework.SideMenu',
'framework.Footer',
'sales.QuotationForm'
],

controllers: [
],

models: [
'framework.form.Combobox'
],

stores: [
'sales.Customer',
'SideMenu'
]
});

Malte123
25 Dec 2013, 7:23 PM
Try to use full qualified names in Store:





Ext.define('TestERP.store.sales.Customer', {
extend: 'Ext.data.Store',
config: {
model: 'TestERP.model.framework.form.Combobox', // framework.form.Combobox',
data: [{
value: '1', display: 'AAA Company'
}, {
value: '2', display: 'BBB Company'
}, {
value: '3', display: 'CCC Company'
}, {
value: '4', display: 'DDD Company'
}, {
value: '---New---', display: 'New'
}] }
});

deathgod86
25 Dec 2013, 9:11 PM
Thanks for your guidance Malte.
After I use full qualified name in Store, the error is gone.
Mind to share why need to use full qualified name please ?

However, I encounter another issue.


TypeError: 'undefined' is not an object (evaluating 'store.on') Bindable.js:101


Code are not changed as from 1st post.
Only change to full qualified name as you mentioned.

Thanks in advance.

Malte123
26 Dec 2013, 9:40 AM
OK - then please select my answer as best answer and don't forget to vote me up.
This is motivation to answer more Questions and also motivates more experienced programmers to help me with more difficult questions :-)

Please open a new Question so I can get more motivation ;)

Also we need the code to see what is on Bindable.js:101

I know the error when I do not load my store by store.load() or have no autoLoad: true