2012-02-15 13 views
2

私はストア内で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: CandidateDistributionstore: '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> 

+1

モデルファイルは正しくロードされていますか? –

+0

モデルファイルがロードされているかどうかを確認するには? – Shekhar

+0

対応するスクリプトはあなたのhtmlの ''になければなりません。あなたは、火かき棒やGoogle Chromeの開発ツールを使って確認できます。モデルとストアを別々のファイルに保存する場合にのみチェックする必要があります。 –

答えて

4

これはExt.tree.Viewで使用されているNodeStore、バグです。ツリーパネルを使用すると、これは常に表示されます。

警告を生成する行を壊してスタックを見ると、TreeStatsのinitComponentによって呼び出されるNodeStoreのコンストラクタによって呼び出されたAbstractStoreのコンストラクタ内にあることがわかります。

+0

ええええええええええええええええええええええと、このエラーが発生するところの正確な行を見ました。私はこの問題を克服する方法を知りたいですか? – Shekhar

+0

それは唯一の警告なので、私はあまり心配しません。 Extにパッチを当てなくても修正できるとは思いません。まだバグレポートがない場合は、提出することができます。また、4.1b2をチェックアウトして、それが修正されているかどうかを確認することもできます。 –

関連する問題