【问题标题】:Problem with ExtJs editor grid panelExtJs 编辑器网格面板的问题
【发布时间】:2011-08-29 12:46:32
【问题描述】:

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

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 事件并添加了一个空行,焦点不会移动到第一行,即第二行仍处于编辑模式。我该如何解决?

【问题讨论】:

    标签: javascript extjs extjs3


    【解决方案1】:

    我已获取您的代码并创建了this demo。如您所见,一切都按预期工作。您确定您向我们提供了无效的代码吗?

    【讨论】:

    • 我非常感谢您抽出时间尝试一下。你是绝对正确的,发布的代码没有问题,但它是由另一个代码创建的,我修复了这个问题。谢谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-09-24
    • 1970-01-01
    • 1970-01-01
    • 2011-02-15
    • 2011-08-06
    • 1970-01-01
    • 2013-03-22
    相关资源
    最近更新 更多