2011-05-09 11 views
4

新しいExtJSのリリースは、あなたのクロムを不安定にする可能性があります(それとも私のコードですか)!私の状況を説明しましょう。ExtJS 4.0 MVCアプリケーションのTreeStoreに関する問題

私はExtJS 4.0の新しいMVCアーキテクチャに取り組んでいます。私はアプリケーションパネルまたはナビゲーションを表示するツリーパネルを持っています。アーキテクチャごとに、ツリーパネルをコントローラ、ビュー、および別のストアに分割しようとしました。

Ext.define('CRM.view.menu.View', { 
    alias: 'widget.menutree', 
    extend: 'Ext.tree.Panel', 

    initComponent: function() { 

     console.log('initComponent of View...'); 

     Ext.apply(this, { 
      title: 'Simple Tree',      
      width: 200,    
      store: 'MainMenu', 
      rootVisible: false 
     }); 

     this.callParent(arguments); 
    } 
}); 

マイツリーのストア:

は、ここに私の見解である

Ext.define('CRM.store.MainMenu', { 
    extend: 'Ext.data.TreeStore', 

    constructor: function() { 

     console.log('Constructor of MainMenu TreeStore'); 

     config = Ext.apply(this,{ 
      proxy: { 
       type: 'ajax', 
       url: 'data/menu.json' 
      },root: { 
       text: 'Menu', 
       id: 'src', 
       expanded: true 
      } 
     }); 

     this.callParent(arguments); 

    } 
}); 

そして、私のコントローラで私も私の店の情報を提供してきました。ここに私のコントローラの設定の一部です:最初の実行で

Ext.define('CRM.controller.MainMenu',{ 
    extend: 'Ext.app.Controller', 
    stores: ['MainMenu'], 
    refs: [ 
     {ref:'menu',selector: 'menutree'}, 
     {ref:'cp',selector: 'centerpane'} 
    ], 
     . 
     . 
     . 

、私は次のエラーを取得:

Object MainMenu has no method 'getRootNode'

しかし、今、私はより多くの奇妙なエラーが出ます:クロームに実行を停止することをchrome just fails to display the app お知らせツリーストアのコンストラクタです。

同時に、Firefoxで:firefox executes better Firefoxはうまく実行されますが、レンダリングされたアプリケーションはありません!今

Ext.define('CRM.view.menu.View', { 
    alias: 'widget.menutree', 
    extend: 'Ext.tree.Panel', 

    initComponent: function() { 

     console.log('initComponent of View...'); 

     Ext.apply(this, { 
      title: 'Simple Tree',      
      width: 200,    
      store: { 
       proxy: { 
        type: 'ajax', 
        url: 'data/menu.json' 
       },root: { 
        text: 'Menu', 
        id: 'src', 
        expanded: true 
       } 
      }, 
      rootVisible: false 
     }); 

     this.callParent(arguments); 
    } 
}); 

いくつかの試行錯誤が..私は..実行している私のアプリケーションを取得する方法を見つけた、それが私の店を使用して回避し、直接、以下のように店舗情報を提供することです後アプリケーションは全く問題なく実行されます。

誰かがMVCアーキテクチャを使用してツリーパネルを作成しようとしましたか?私はこれを修正する方法の手掛かりがありません!

答えて

3

これは既知の問題ですか? ExtJS forumsから引用:

The parent class of "Ext.tree.Panel" looks for the store in the store manager in the "initComponent" method, but "Ext.tree.Panel" tries to use it before.

だから、あなたのツリーに別の方法をあなたの店をコーディングするだろう一つの方法は、initComponent方法でストアを再割り当てすることです。コードは次のとおりです。

initComponent: function(){ 
    this.store = Ext.data.StoreManager.lookup(this.store); 
    this.callParent(arguments); 
} 
関連する問題