Results 1 to 6 of 6

Thread: [6.5.2 Classic] Removing all records of a grid and then clicking within it throws err

    You found a bug! We've classified it as EXTJS-26546 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha Premium User vadimv's Avatar
    Join Date
    Sep 2010
    Location
    Cluj, Romania
    Posts
    811

    Default [6.5.2 Classic] Removing all records of a grid and then clicking within it throws err

    Fiddle: https://fiddle.sencha.com/#view/editor&fiddle/28vi

    Steps:

    1. Remove all record by clicking on the actioncolumn on each one.
    2. Click on the empty grid anywhere
    3. Click on console to see the error

    Gif:

    grid.jpg

    Screenshot:

    Screen Shot 2017-10-27 at 1.46.32 PM.jpg


    Override, see:

    Code:
                        /**
                         * OVERRIDE
                         */
                        if (cell !== false) {
                            Ext.fly(cell).focus();
                        }
                        /**
                         * END OVERRIDE
                         */
    in

    Code:
    Ext.define('overrides.view.Table', {
        override: 'Ext.view.Table',
    
    
        privates: {
            /**
             * @override
             * Fixes issue in version 6.2.1 (validate this override is still necessary after upgrading).
             * Removing all records of a grid and then clicking on the grid throws error
             * Before trying to set the focus on a cell validate the actual cell was retrieved instead of false.
             */
            setActionableMode: function (enabled, position) {
                var me = this,
                    navModel = me.getNavigationModel(),
                    activeEl,
                    actionables = me.grid.actionables,
                    len = actionables.length,
                    i,
                    record,
                    column,
                    isActionable = false,
                    lockingPartner, cell;
    
    
                // No mode change.
                // ownerGrid's call will NOT fire mode change event upon false return.
                if (me.actionableMode === enabled) {
                    // If we're not actinoable already, or (we are actionable already at that position) return false.
                    // Test using mandatory passed position because we may not have an actionPosition if we are
                    // the lockingPartner of an actionable view that contained the action position.
                    //
                    // If we being told to go into actionable mode but at another position, we must continue.
                    // This is just actionable navigation.
                    if (!enabled || position.isEqual(me.actionPosition)) {
                        return false;
                    }
                }
    
    
                // If this View or its lockingPartner contains the current focus position, then make the tab bumpers tabbable
                // and move them to surround the focused row.
                if (enabled) {
                    if (position && (position.view === me || (position.view === (lockingPartner = me.lockingPartner) && lockingPartner.actionableMode))) {
                        isActionable = me.activateCell(position);
                    }
    
    
                    // Did not enter actionable mode.
                    // ownerGrid's call will NOT fire mode change event upon false return.
                    return isActionable;
                } else {
                    // Capture before exiting from actionable mode moves focus
                    activeEl = Ext.fly(Ext.Element.getActiveElement());
    
    
                    // Blur the focused descendant, but do not trigger focusLeave.
                    // This is so that when the focus is restored to the cell which contained
                    // the active content, it will not be a FocusEnter from the universe.
                    if (me.el.contains(activeEl) && !Ext.fly(activeEl).is(me.getCellSelector())) {
    
    
                        // Row to return focus to.
                        record = (me.actionPosition && me.actionPosition.record) || me.getRecord(activeEl);
                        column = me.getHeaderByCell(activeEl.findParent(me.getCellSelector()));
    
    
                        cell = position && position.getCell(true);
    
    
                        // Do not allow focus to fly out of the view when the actionables are deactivated
                        // (and blurred/hidden). Restore focus to the cell in which actionable mode is active.
                        // Note that the original position may no longer be valid, e.g. when the record
                        // was removed.
                        if (!position || !cell) {
                            position = new Ext.grid.CellContext(me).setPosition(record || 0, column || 0);
                            cell = position.getCell(true);
                        }
    
    
                        // Ext.grid.NavigationModel#onFocusMove will NOT react and navigate because the actionableMode
                        // flag is still set at this point.
                        /**
                         * OVERRIDE
                         */
                        if (cell !== false) {
                            Ext.fly(cell).focus();
                        }
                        /**
                         * END OVERRIDE
                         */
    
    
                        // Let's update the activeEl after focus here
                        activeEl = Ext.fly(Ext.Element.getActiveElement());
    
    
                        // If that focus triggered handlers (eg CellEditor after edit handlers) which
                        // programatically moved focus somewhere, and the target cell has been unfocused, defer to that,
                        // null out position, so that we do not navigate to that cell below.
                        // See EXTJS-20395
                        if (!(me.el.contains(activeEl) && activeEl.is(me.getCellSelector()))) {
                            position = null;
                        }
                    }
    
    
                    // We are exiting actionable mode.
                    // Tell all registered Actionables about this fact if they need to know.
                    for (i = 0; i < len; i++) {
                        if (actionables[i].deactivate) {
                            actionables[i].deactivate();
                        }
                    }
    
    
                    // If we had begun action (we may be a dormant lockingPartner), make any tabbables untabbable
                    if (me.actionRow) {
                        me.actionRow.saveTabbableState({
                            skipSelf: true,
                            includeSaved: false
                        });
                    }
    
    
                    if (me.destroyed) {
                        return false;
                    }
    
    
                    // These flags MUST be set before focus restoration to the owning cell.
                    // so that when Ext.grid.NavigationModel#setPosition attempts to exit actionable mode, we don't recurse.
                    me.actionableMode = me.ownerGrid.actionableMode = false;
                    me.actionPosition = navModel.actionPosition = me.actionRow = null;
    
    
                    // Push focus out to where it was requested to go.
                    if (position) {
                        navModel.setPosition(position);
                    }
                }
            }
        }
    });
    Github https://github.com/vadimpopa
    Blogging @ : http://vadimpopa.com
    Twitter: @vadimvpopa

  2. #2
    Sencha Staff
    Join Date
    Sep 2017
    Posts
    126

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

  3. #3
    Sencha User
    Join Date
    Mar 2016
    Posts
    1

    Default Thanks

    Hi, its work fine!

  4. #4
    Sencha Premium User vadimv's Avatar
    Join Date
    Sep 2010
    Location
    Cluj, Romania
    Posts
    811

    Default

    Quote Originally Posted by guneri View Post
    Hi, its work fine!
    cool
    Github https://github.com/vadimpopa
    Blogging @ : http://vadimpopa.com
    Twitter: @vadimvpopa

  5. #5

    Join Date
    Jan 2008
    Location
    Levittown, PA
    Posts
    358

    Default

    Thank you. I hope you got a few support credits from Sencha.

  6. #6
    Sencha Premium User vadimv's Avatar
    Join Date
    Sep 2010
    Location
    Cluj, Romania
    Posts
    811

    Default

    who needs Support these days, we can handle it without as long as the code is easy to fix.
    Github https://github.com/vadimpopa
    Blogging @ : http://vadimpopa.com
    Twitter: @vadimvpopa

Similar Threads

  1. Replies: 5
    Last Post: 16 Jun 2017, 1:53 AM
  2. [DUP] Removing multiple records from a store throws an expection
    By thomas.hardwick in forum Ext 5: Bugs
    Replies: 2
    Last Post: 27 Jul 2015, 4:12 AM
  3. Replies: 5
    Last Post: 6 Aug 2011, 1:33 AM
  4. Replies: 1
    Last Post: 8 Jun 2011, 1:18 AM
  5. [FIXED] Removing an element from a grid store throws exception
    By yleguern in forum Ext GWT: Bugs (1.x)
    Replies: 1
    Last Post: 28 Aug 2008, 9:02 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •