2012-06-12 2 views
0

나중에이 저장소를 다시 사용하기 때문에 companyList를 저장하는 data.store를 정의하고 싶습니다.ExtJs4 콤보 상자의 MVC, data.store

tbar: Ext.create('Ext.Toolbar', { 
    items: [ 
     { 
     xtype : 'combo', 
     name : 'companyCode', 
     editable : false, 
     valueField : 'companyCode', 
     displayField : 'companyName', 
     triggerAction : 'all', 
     store: Ext.create('Ext.data.Store', { 
       fields: ['companyCode', 'companyName'], 
       proxy: { 
       type: 'ajax', 
       url: '/Reports/GetCompanyList/', 
       reader: 'json', 
       actionMethods: { 
        read: 'POST' 
       } 
       }, 
       autoLoad:true 
      }) 

위의 코드는 작동하며 저장소를 app 폴더 아래의 저장소 폴더에 넣으려고합니다.

저장/CompanyList_store.js

Ext.define('App.store.CompanyList_store', { 
    extend: "Ext.data.Store", 
    fields: ['companyCode', 'companyName'], 
    proxy: { 
     type: 'ajax', 
     url: '/Reports/GetCompanyList/', 
     reader: 'json', 
     actionMethods: { 
      read: 'POST' 
     } 
    }, 
    autoLoad: true 
}); 

내가 컨트롤러에서이 저장소를 추가 할 수 있습니다. 내가 잘못 뭐하는 거지

tbar: Ext.create('Ext.Toolbar', { 
    items: [ 
     { 
     xtype : 'combo', 
     name : 'companyCode', 
     editable : false, 
     valueField : 'companyCode', 
     displayField : 'companyName', 
     triggerAction : 'all', 
     store: 'CompanyList_store' //it does not work. 

Ext.define("App.controller.InventoryReport", { 
    extend: "Ext.app.Controller", 
    stores: ['Inventory_store', 'CompanyList_store'], 
    . 
    . 

및 콤보 상자 저장소에이 저장소를 추가 ? 아무도 모른다면 조언 해주세요.

답변

1

모든 매장을 애플리케이션 파일에 포함하는 것을 잊었을 것 같습니다.

그것은이 같은해야한다 : 당신이 다른 폴더에 상점을 배치 (내선 응용 프로그램 사이에 공유 할) 경우 다음과 같은 포함해야

Ext.application({ 
    appFolder: ... 
    controllers: [your controllers here], 
    stores: [your stores here] 
}); 

을 그리고 : Ext.Loader.setPath([namespace], [path to the folder with stores])