私はストア内でextjsのモデルを使って作業しているときに不満を感じています。私はストア内でモデル名を指定していますが、 Store defined with no model. You may have mistyped the model name.
エラーが発生しています。extjs 4のストアでモデル名を指定する方法は?
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');
}
}
});
私は、model: 'Location'
にmodel: "Location"
をmodel: 'iWork.model.Location',
を変更しようとした、とmodel: "iWork.model.Location"
にまだ働いていないその:
は、ここに私のコードです。
Ext.define('iWork.model.Location', {
extend: 'Ext.data.Model',
fields: [
{name: 'name', type: 'string'},
{name: 'candidateCount', type: 'string'}
]
});
と、次のようにこのストアを参照するtreepanelコードは次のとおりです:
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);
}
});
は、私もそのないstore: 'CandidateDistribution'
からstore: 'iWork.store.CandidateDistribution'
を変更しようとしましたが、している次のようにモデルファイル内
コードですワーキング。
私はstore: CandidateDistribution
にstore: 'iWork.store.CandidateDistribution'
を変更した場合、私はext-debug.js (line 8002)
me.store is undefined
[Break On This Error] },
でエラーを以下の取得私はミスを犯した場所を見つけることができないのです。私が他の設定を忘れた場合、または私が間違っていることを私に知らせてください。
ありがとうございます!
EDIT 1:次のように私のアプリのindex.htmlファイルを検索します:
<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>
モデルファイルは正しくロードされていますか? –
モデルファイルがロードされているかどうかを確認するには? – Shekhar
対応するスクリプトはあなたのhtmlの '
'になければなりません。あなたは、火かき棒やGoogle Chromeの開発ツールを使って確認できます。モデルとストアを別々のファイルに保存する場合にのみチェックする必要があります。 –