2011-08-29 44 views
1

我有一个绑定到商店的extjs编辑器网格面板(3.3.1)。新记录通过顶部的空行添加到网格中。在商店的负载上,我在网格顶部添加了一个空行。当用户添加一个新值并且焦点丢失时,我将添加另一个空行。ExtJs编辑器网格面板的问题

AV.ClassifiedCategories = Ext.extend(Ext.grid.EditorGridPanel, { 
    .... 

initComponent: function(){ 

    this.store = this.initialConfig.store; 

      //add an empty row at top 
    this.store.on('load', this.addCategory, this); 

      Ext.apply(this, 
    { 
     clicksToEdit: 1,    
     listeners: 
     { 
     afteredit : function(e){ 
       this.addCategory();       
     }, 
     scope: this 
     } 
    }); 
    }, 

    //adds an empty row and insert a record to store 
    addCategory: function(){ 
    var Category = this.getStore().recordType; 
    var cat = new Category({ cat_id: null, cat_name: "" });  

    this.stopEditing();  
    this.store.insert(0, cat); 
    this.startEditing(0, 0); 

    return cat; 
}, 

    ... 
}); 

问题面临这里是一旦afteredit事件被触发,一个空行被添加的焦点不移动到第一行即第二行仍处于编辑模式。我如何解决这个问题?

回答

0

我已将您的代码并创建了this demo。正如你可以看到一切按预期工作。你确定你向我们提供了非工作代码吗?

+0

我真的很感激花时间尝试一下。你绝对没问题,但是它是由另一个代码创建的,我修正了这个问题。谢谢。 – VJAI