Extjs mvc problems

Extjs mvc problems

本文关键字:problems mvc Extjs      更新时间:2023-09-26

我试图重新创建他们简单示例的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'{extend:"外部应用程序控制器",

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();
}

});

'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",
}