Ext JS 4.2 componentLayoutCounter

206 Views Asked by At

I am adding multiple grid(cellplugin in each grid) in tab panel and displaying it. 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 -

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.

My query is how we can ensure that componentLayoutCounter value always set correctly ?

1

There are 1 best solutions below

0
chdig On

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:

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;
}   

});