2011-05-31 73 views
2

我想重新創建他們的簡單示例的MVC模型,但我有以下問題。這是我的電網聲明Extjs mvc問題

Ext.define('MCMS.view.items.List' ,{ 
extend: 'Ext.grid.Panel', 
alias : 'widget.itemsList', 
title : lang.items, 
store: 'Items', 
loadMask: true, 
columns: [ 
     {header: "#ID", width: 60, dataIndex: 'id', sortable: true}, 
     {header: "Title", width: 250, dataIndex: 'title', sortable: true}, 
     {header: "Availability", width: 60, dataIndex: 'active', sortable: true}, 
     {header: "Category", width: 200, dataIndex: 'category',sortable:false,renderer: function(value, metaData, record, rowIndex, colIndex, store) {       
      var cat = new Array; 
      Ext.each(value, function(person, index) { 
       cat.push('<a href="#showCat" rel="'+ this.categoryid + '">' + this.category + '</a>'); 
      }); 
      return cat.join(' , '); }}, 
], 
bbar : Ext.create('Ext.PagingToolbar', { 
    store: 'Items', 
    pageSize: 5, 
    displayInfo: true, 
    displayMsg: 'Displaying topics {0} - {1} of {2}', 
    emptyMsg: "No topics to display", 
}), 

});

我得到了一個非常普遍的類型錯誤即使它們的文件已被加載,以下類也沒有聲明:'MCMS.view.items.List'。請檢查他們相應的文件的源代碼可能的錯別字:'app/view/items/List.js'「 當我刪除bbar部分它工作得很好。我的控制器看起來像 Ext.define('MCMS.controller .Items',{ 延長: 'Ext.app.Controller',

stores: ['Items'], 

models: ['Item'], 

views: ['items.Edit', 'items.List','items.itemsTabs'], 

refs: [ 
    { 
     ref: 'itemsPanel', 
     selector: 'panel' 
    } 
], 

init: function() { 
    this.control({ 
     'viewport > itemsTabs itemsList dataview': { 
      itemdblclick: this.editItem 
     }, 
     'itemEdit button[action=save]': { 
      click: this.updateItem 
     } 
    }); 
}, 

editItem: function(grid, record) { 
    var edit = Ext.create('MCMS.view.items.Edit').show(); 

    edit.down('form').loadRecord(record); 
}, 

updateItem: function(button) { 
    var win = button.up('window'), 
     form = win.down('form'), 
     record = form.getRecord(), 
     values = form.getValues(); 

    record.set(values); 
    win.close(); 
    this.getItemsStore().sync(); 
} 

});

回答

2

重命名'Ext.PagingToolbar''Ext.toolbar.Paging'

如果不工作,嘗試像xtype基於配置這 -


bbar : { 
    xtype:'pagingtoolbar' 
    store: 'Items', 
    pageSize: 5, 
    displayInfo: true, 
    displayMsg: 'Displaying topics {0} - {1} of {2}', 
    emptyMsg: "No topics to display", 
} 
+0

非常好用!謝謝。 – TigrouMeow 2012-04-17 08:03:40