2010-05-11 79 views
1

我很確定這是一個微不足道的問題,我只是有點愚蠢。非常感謝您的幫助。extjs - 'Store is undefined'

在控制/ dashboard.js我:

Ext.ill.WCSS.controls.dashboard = { 
     xtype:'portal', 
     region:'center', 
     margins:'35 5 5 0', 
     items:[{ 
      columnWidth: 1, 
      style:'padding:10px', 
      items:[{ 
       title: 'My Cluster Jobs', 
       layout:'fit', 
       html: "test" 
      }] 
     },{ 
      columnWidth: 1, 
      style:'padding:10px', 
      items:[{ 
       title: 'All Cluster Jobs', 
       iconCls: 'icon-queue', 
       html: "test", 
       items: new Ext.grid.GridPanel({ 
         title: 'Cluster Job Queue', 
         store: Ext.ill.WCSS.stores.dashboardClusterJobs, 
         width: 791, 
         height: 333, 
         frame: true, 
         loadMask: true, 
         stateful: false, 
         autoHeight: true, 
         stripeRows: true, 
         floating: false, 
         footer: false, 
         collapsible: false, 
         animCollapse: false, 
         titleCollapse: false, 
         columns:[ 
           { 
            xtype: 'gridcolumn', 
            header: 'Job ID', 
            sortable: true, 
            resizable: true, 
            width: 100, 
            dataIndex: 'JB_job_number', 
            fixed: false 
           }, 
           { 
            xtype: 'gridcolumn', 
            header: 'Priority', 
            sortable: true, 
            resizable: true, 
            width: 100, 
            dataIndex: 'JAT_prio', 
            fixed: false 
           }, 
           { 
            xtype: 'gridcolumn', 
            header: 'User', 
            sortable: true, 
            resizable: true, 
            width: 100, 
            dataIndex: 'JB_owner' 
           }, 
           { 
            xtype: 'gridcolumn', 
            header: 'State', 
            sortable: true, 
            resizable: true, 
            width: 100, 
            dataIndex: 'state' 
           }, 
           { 
            xtype: 'gridcolumn', 
            header: 'Date Submitted', 
            sortable: true, 
            resizable: true, 
            width: 100, 
            dataIndex: 'JAT_start_time' 
           }, 
           { 
            xtype: 'gridcolumn', 
            header: 'Queue', 
            sortable: true, 
            resizable: true, 
            width: 100, 
            dataIndex: 'queue_name' 
           }, 
           { 
            xtype: 'gridcolumn', 
            header: 'CPUs', 
            sortable: true, 
            resizable: true, 
            width: 100, 
            dataIndex: 'slots' 
           } 
          ], 
          bbar: { 
           xtype: 'paging', 
           store: 'storeClusterQueue', 
           displayInfo: true, 
           refreshText: 'Retrieving queue status...', 
           emptyMsg: 'No jobs to retrieve', 
           id: 'clusterQueuePaging' 
          } 
        }) 
      }] 
}] 
}; 

夠簡單,注意參考 'Ext.ill.WCSS.stores.dashboardClusterJobs'

商店/ dashboard.js

所以我只有這個:

Ext.ill.WCSS.stores.dashboardClusterJobs = new Ext.data.XmlStore({ 
    storeId: 'storeClusterJobs', 
    record: 'job_list', 
    autoLoad: true, 
    url: 'joblist.xml', 
    idPath: 'job_info', 
    remoteSort: false, 
    fields: [ 
     { 
      name: 'JB_job_number' 
     }, 
     { 
      name: 'JAT_prio' 
     }, 
     { 
      name: 'JB_name' 
     }, 
     { 
      name: 'JB_owner' 
     }, 
     { 
      name: 'state' 
     }, 
     { 
      name: 'JAT_start_time' 
     }, 
     { 
      name: 'slots' 
     }, 
     { 
      name: 'queue_name' 
     } 
    ] 
}); 

我運行代碼,我得到「商店未定義」:S它混淆了我很多。所有的javascripts都被包含在正確的順序中。

<script type="text/javascript" src="/js/portal.js"></script> 
<script type="text/javascript" src="/js/stores/dashboard.js"></script> 
<script type="text/javascript" src="/js/controls/dashboard.js"></script> 

謝謝你們!

+0

什麼'alert(Ext.ill.WCSS.stores.dashboardClusterJobs)'說? – Alsciende 2010-05-11 14:30:16

回答

0

我想通了。這與我的JavaScript文件的排序有關。 (ooops!)非常感謝你的幫助,並對遲到的迴應表示歉意。

1

我認爲我們需要更多信息。您使用的是門戶網站(代碼缺失)的xtype,並且不清楚該對象如何實例化(代碼缺失)。

2

它可能是一個命名空間問題。你的Ext.ns聲明是什麼樣的?

+0

感謝這篇文章...我的問題是與錯誤的命名空間! – 2012-01-16 16:29:07