2013-11-09 29 views
1

我真的被困在試圖添加一個過濾器功能到我的網格。我的網格鑑於定義是這樣的:Extjs 4 - 無法調用未定義的方法'開'

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'。它看起來像我的網格是未定義的。 我在做什麼錯? 請幫忙。

回答

0

有一個在initComponent: function()Ext.applyIf(me,...
dockedItems:[]

閉合]托架後的unnecesarry ,從第一行中刪除,下面],

 ], 

    }); 

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

} 
+0

仍然得到同樣的錯誤on「grid.on」:無法在FiltersFeature.js中調用未定義的方法'on' – Toto

相關問題