1

我真的一直在尝试向我的网格添加过滤器功能。我的网格在视图中定义,如下所示:

Ext.define('magiq.view.Partners.GrdPartners',{
extend: 'Ext.grid.Panel',
alias:'widget.gridPartners',
store:MyStorePartners, 
border: false,
features: [{ftype: 'filters',
        autoReload: true,
        local: true}],
listeners: {
        'selectionchange': function(view, records) {
            this.down('#delete').setDisabled(!records.length);
        }
},
initComponent: function() {
    var me = this;
    Ext.applyIf(me, {
        columns : [
                {
                  xtype: 'rownumberer',
                  width: 25,
                  sortable: false
                },
               {header:"Id",dataIndex:"id",width:50,hidden:true},
               {header:"Partner",dataIndex:"Partner",flex:1, filter: {type: 'string'}},
               {header:"CUI",dataIndex:"CUI",flex:1},
               {header:"Fiscal Code",dataIndex:"FiscalCode",flex:1},
               {header:"Phone",dataIndex:"Phone",flex:1}

        ],
        dockedItems: [
                {
                xtype: 'toolbar',
                dock: 'top',
                items: [
                    {
                    itemId: 'Add',
                    text: 'Add',
                    iconCls: 'add',
                    action:'add'
                    },'-',{
                    itemId: 'edit',
                    text: 'Edit',
                    iconCls: 'edit',
                    scope: this,
                    action:'edit'

                    },'-',{
                    itemId: 'delete',
                    text: 'Delete',
                    iconCls: 'delete',
                    disabled: true,
                    action:'delete' 
                    },'-',{
                    xtype: 'searchfield',
                    emptyText: 'Search for Partners',
                    store:me.store,
                    width: 400,
                    fieldLabel: 'Search',
                    labelWidth: 50,
                    name:'mySearchfield'
                    }               
                ]
            },
            {
                xtype: 'pagingtoolbar',
                dock: 'bottom',
                displayInfo: true,
                store:me.store,
                displayMsg: 'Displaying records {0} - {1} of {2}',
                emptyMsg: "No records to display",
                items: [
                  {
                    xtype: 'tbseparator'
                  },
                  {
                    xtype: 'button',
                    text: 'Print',
                    iconCls: 'print',
                    action:'print' 
                  }

                ]
            }
        ],

    });

    me.callParent(arguments);
    me.store.load();

}


    });

我的 app.js:

Ext.Loader.setConfig({
enabled : true,
paths   : {
    magiq   : "App"

}
});
Ext.Loader.setPath('Ext.ux', 'resources/ux');
Ext.require([
'Ext.grid.*',
'Ext.data.*',
'Ext.ux.grid.FiltersFeature','Ext.ux.grid.menu.ListMenu',
    'Ext.ux.grid.menu.RangeMenu',
    'Ext.ux.grid.filter.BooleanFilter',
    'Ext.ux.grid.filter.DateFilter',
    'Ext.ux.grid.filter.ListFilter',
    'Ext.ux.grid.filter.NumericFilter',
    'Ext.ux.grid.filter.StringFilter'
]);
Ext.application({  
    name        : "magiq", 
    controllers : ['Partners.Partners'],
    launch      : function(){  
          var MyViewPrincipal = Ext.create("magiq.view.Principal.MyViewport")
         } 
});

当我尝试初始化网格时,出现此错误:

未捕获的类型错误:无法调用 FiltersFeature.js 中未定义的方法“on”。看起来我的网格是未定义的。我究竟做错了什么?请帮忙。

4

1 回答 1

0

,initComponent: function()'s的右括号Ext.applyIf(me,...
之后有一个不必要的]dockedItems:[]

,从下面的第一行中删除],

        ],

    });

    me.callParent(arguments);
    me.store.load();

}
于 2013-11-09T10:33:59.193 回答