I am getting frustrated while working with store and model of extjs 4. I am getting
Store defined with no model. You may have mistyped the model name.
error even though I have specified model name inside store.
Here is my code :
Ext.define('iWork.store.CandidateDistribution', {
extend: 'Ext.data.TreeStore',
autoLoad: true,
requires: 'iWork.model.Location',
model: 'iWork.model.Location',
proxy: {
type: 'ajax',
url: 'data/CandidateDistribution/CandidateCount.json',
reader: {
type: 'pentahoReader',
root: 'resultset'
}
},
listeners: {
load: function(treeStore, currentNode, records, success, options) {
console.log('in load listener');
console.log(records);
},
beforeappend: function(currentNode, newNode, options) {
console.log('in beforeAppend listener');
},
add: function(store, records, options) {
console.log('in add listener');
},
beforeinsert: function(currentNode, newNode, option) {
console.log('in beforeInsert listener');
}
}
});
I tried changing model: 'iWork.model.Location',
to model: 'Location'
, model: "Location"
, and to model: "iWork.model.Location"
but still its not working.
Code in model file is as follows:
Ext.define('iWork.model.Location', {
extend: 'Ext.data.Model',
fields: [
{name: 'name', type: 'string'},
{name: 'candidateCount', type: 'string'}
]
});
and treepanel code which references this store is as follows :
Ext.define('iWork.view.CandidateDistribution', {
extend: 'Ext.window.Window',
alias: 'widget.candidateDistribution',
require: ['iWork.store.CandidateDistribution'],
layout: {
type: 'hbox',
align: 'stretch'
},
autoShow: true,
initComponent: function() {
this.items = [
{
xtype: 'treepanel',
title: 'Location wise customer Distribution',
store: 'iWork.store.CandidateDistribution',
width: '25%',
height: '100%',
rootVisible: false
}
];
this.callParent(arguments);
}
});
I have tried to change store: 'iWork.store.CandidateDistribution'
to store: 'CandidateDistribution'
but then also its not working.
If I change store: 'iWork.store.CandidateDistribution'
to store: CandidateDistribution
, I get following error in ext-debug.js (line 8002)
me.store is undefined
[Break On This Error] },
I am not able to find where have I made mistake. Please let me know if I have missed any other configuration or what I have done wrong.
Thanks !!
EDIT 1 : index.html file of my app looks as follows :
<html>
<head>
<title>iWork Dashboards</title>
<link rel="stylesheet" type="text/css" href="../extjs/resources/css/ext-all.css" />
<script type="text/javascript" src="../extjs/ext-debug.js"></script>
<script type="text/javascript" src="app/app.js"></script>
<script type="text/javascript" src="app/PentahoReader.js"></script>
</head>
<body>
</body>
</html>