2

extjs 4のストアとモデルを操作しているときにイライラし Store defined with no model. You may have mistyped the model name.ます。ストア内でモデル名を指定したのに、エラーが発生します。

これが私のコードです:

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: 'iWork.model.Location',してみましたが、それでも機能しません。model: 'Location'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: 'iWork.store.CandidateDistribution'ましstore: 'CandidateDistribution'たが、機能しません。

に変更store: 'iWork.store.CandidateDistribution'するとstore: CandidateDistribution、次のエラーが発生しますext-debug.js (line 8002)

me.store is undefined
[Break On This Error] }, 

どこを間違えたのかわからない。他の構成を見逃した場合、または間違ったことを知らせてください。

ありがとう !!


編集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>

4

1 に答える 1

4

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

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

于 2012-02-15T14:24:33.710 に答える