【问题标题】:Extjs mvc problemsextjs mvc 问题
【发布时间】:2011-09-05 07:29:05
【问题描述】:

我正在尝试重新创建他们简单示例的 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();
}

});

【问题讨论】:

    标签: javascript extjs4 extjs


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2011-09-09
      • 1970-01-01
      • 1970-01-01
      • 2013-06-07
      • 2011-02-24
      • 2013-07-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多