简体   繁体   English

Ext JS 4.2 componentLayoutCounter

[英]Ext JS 4.2 componentLayoutCounter

I am adding multiple grid(cellplugin in each grid) in tab panel and displaying it. 我在选项卡面板中添加多个网格(每个网格中的cellplugin)并显示它。 however when I click on cell for editing it doesn't display text area. 但是,当我单击单元格进行编辑时,它不会显示文本区域。

I have configured editor as text area also. 我也将编辑器配置为文本区域。

I tried to debug plugin and found issue(Editing.js) in below code - 我尝试调试插件并在下面的代码中发现了问题(Editing.js)-

startEdit: function(record, columnHeader) {
        var me = this,
            context,
            layoutView = me.grid.lockable ? me.grid : me.view;
            // The view must have had a layout to show the editor correctly, 
            //  defer until    that time.
            // In case a grid's startup code invokes editing immediately.
            if (!layoutView.componentLayoutCounter) {
            layoutView.on({
                boxready: Ext.Function.bind(me.startEdit, me, [record, columnHeader]),
                single: true
            });
            return false;
           ....
           ....

        }

Issue is componentLayoutCounter have value is 0 because of that if block gets executed and false is returned which stops editing. 问题是componentLayoutCounter的值为0,因为如果执行块并返回false则停止编辑。

My query is how we can ensure that componentLayoutCounter value always set correctly ? 我的查询是我们如何确保componentLayoutCounter值始终正确设置?

This is a year later, but if anyone hits the bug, here's the solution in an override. 这是一年后的事情,但是如果有人遇到了这个错误,下面是替代方法。 It checks whether the layout is initialized as well as the componentLayoutCounter: 它检查布局是否已初始化以及componentLayoutCounter:

Ext.override(Ext.grid.plugin.Editing, {
startEdit: function(record, columnHeader) {
    var me = this,
        context,
        layoutView = me.grid.lockable ? me.grid : me.view;

    //BUGFIX: added check to make sure componentLayout is not initialized before denying edit. 
    if (!layoutView.componentLayoutCounter && !layoutView.componentLayout.initialized) {
        layoutView.on({
            boxready: Ext.Function.bind(me.startEdit, me, [record, columnHeader]),
            single: true
        });
        console.log(layoutView.componentLayoutCounter,'componentLayoutCounter not set, so not starting edit',me.view,me,me.view.componentLayout);
        return false;
    }

    // If grid collapsed, or view not truly visible, don't even calculate a context - we cannot edit
    if (me.grid.collapsed || !me.grid.view.isVisible(true)) {
        //console.log('either the grid is collapsed ',me.grid.collapsed,' or not visible ',me.grid.view.isVisible);
        return false;
    }

    context = me.getEditingContext(record, columnHeader);
    //console.log('trying to find context',context,' from ',record,columnHeader);
    if (context == null) {
        return false;
    }
    if (!me.preventBeforeCheck) {
        if (me.beforeEdit(context) === false || me.fireEvent('beforeedit', me, context) === false || context.cancel) {
            return false;
        }
    }

    return context;
}   

}); });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM