【问题标题】:Grid double click, RowEditing throws: Uncaught TypeError: Cannot read property 'apply' of undefine网格双击,RowEditing 抛出:Uncaught TypeError: Cannot read property 'apply' of undefined
【发布时间】:2014-08-20 09:46:21
【问题描述】:

我明白了 未捕获的类型错误:无法读取未定义的属性“应用” 当我双击网格行时。我不确定为什么会这样。

我已阅读此内容 [How to access plugin in ExtJs MVC 和 [Uncaught TypeError: Cannot read property 'apply' of undefined with Sencha

这里是代码。

Ext.define('App.view.admin.PersonsGrid' ,{
extend:'Ext.grid.Panel',
requires: ['Ext.grid.plugin.RowEditing', 'Ext.toolbar.Paging'],
alias:'widget.admin-personsgrid',
title:'People',
itemId:'personGrid',
autoScroll:true,
selType: 'rowmodel',
plugins: [
          {
              ptype: 'rowediting',
              //clicksToEdit: 1,
              clicksToMoveEditor: 2,
              autoCancel: false,
              pluginId: 'rowediting'
          }
      ],
   ],
tbar:[
      {text:'Add Person', itemId:'add'},
      {text:'Edit Person', itemId:'edit'},
      {text:'Remove Person', itemId:'remove'},
      '->',
      'Search:',
      {
        xtype:'textfield',
        name:'searchValueField',
        width:200,
     },
     {
         text:'Submit',
         itemId: 'submit',

     }
  ],
  initComponent: function() {
    this.store = Ext.create('Ext.data.Store',{
        model:'App.model.Person',
        remoteFilter:true,
        remoteSort:true,
        pageSize:100
    });
     this.columns = [
                    {
                       text:'Last Name', dataIndex:'lastName',
                       editor: {xtype: 'textfield', allowBlank: false}
                    },
                    {
                        text:'First Name', dataIndex:'firstName',
                        editor: {xtype: 'textfield', allowBlank: false}
                    },
                    {
                       text:'Email', dataIndex:'email',
                       editor: {vtype: 'email', allowBlank: false}
                    },
                    {
                        text:'Org Unit', dataIndex:'orgUnitName',
                        editor: {xtype: 'textfield', allowBlank: false},
                    },
                    {
                        text:'Location', dataIndex:'name', editor: {
                        xtype: 'textfield', allowBlank: false}
                     },
                     {
                          text:'Office Phone', dataIndex:'officePhone',editor: {
                          xtype: 'textfield', allowBlank: false},
                     },
                     {
                          text:'Mobile Phone', dataIndex:'mobilePhone',editor: {
                          xtype: 'textfield', allowBlank: false}
                     },
                     {
                          text:'Home Phone', dataIndex:'homePhone',editor: {
                          xtype: 'textfield', allowBlank: false}
                     }

     ];
          this.dockedItems = [
                  {
                    xtype: 'pagingtoolbar',
                    ui: 'footer',
                    defaultButtonUI: 'default',
                    dock: 'bottom',
                    displayInfo: true,
                    store: this.store
                  }
            ];    
        this.callParent( arguments );
    } 

});

【问题讨论】:

    标签: model-view-controller grid extjs4


    【解决方案1】:

    好的, 我收到了这个奇怪的消息,因为在控制器中我捕获了事件 itemdblclick

    'grid[xtype=admin-personsgrid] ' : {
          edit: this.savePerson,
          cancelEdit: this.cancelPersonEdit,
          beforerende: this.loadPersonRecords,
         **itemdblclick: this.personDoubleClicked,**
         itemcontextmenu: this.showpersonContextMenu
    },
    

    对于 itemdblclick:this.personDoubleClicked,
    我没有写任何函数来处理双击。 因此错误弹出。 我禁用了双击,因为我现在不需要它。 extjs 的经验教训。如果不需要,请不要添加侦听器。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-04-22
      • 2017-04-24
      • 1970-01-01
      • 2013-01-15
      • 1970-01-01
      • 2019-02-12
      • 2017-12-29
      • 2021-09-20
      相关资源
      最近更新 更多