You found a bug! We've classified it as EXTJS-8789 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    17
    Vote Rating
    0
    cs0ip is on a distinguished road

      0  

    Default [4.2.0.489] Grid focus problems

    [4.2.0.489] Grid focus problems


    Test:
    Code:
    Ext.onReady(function() {
      Ext.create('Ext.container.Viewport', {
        layout: 'border',
        items: [
          {
            region: 'center',
            xtype: 'grid',
            id: 'grid',
            store: Ext.create('Ext.data.Store', {
              fields: [
                {name: 'id', convert: null, defaultValue: undefined},
                {name: 'title', convert: null, defaultValue: undefined}
              ]
            }),
            columns: [
              {
                text: 'ID',
                dataIndex: 'id'
              },
              {
                text: 'Title',
                dataIndex: 'title'
              }
            ],
            listeners: {
              afterrender: function (grid) {
                for (var i = 0; i < 10; i++)
                  grid.getStore().add({id: i, title: 'title' + i});
                grid.getView().on({
                  'focus': function () {
                    console.log('view focus');
                  },
                  'blur': function () {
                    console.log('view blur');
                  }
                });
                grid.getView().getEl().on({
                  'focus': function () {
                    console.log('view el focus');
                  },
                  'blur': function () {
                    console.log('view el blur');
                  }
                });
                setTimeout(function () {
                  console.log('view focus()');
                  grid.getView().focus();
                  setTimeout(function () {
                    console.log('view el focus()');
                    grid.getView().getEl().focus();
                    setTimeout(function () {
                      console.log('setLastFocused()');
                      grid.getSelectionModel().setLastFocused(grid.getStore().getAt(5));
                    }, 1);
                  }, 1);
                }, 1);
              }
            }
          }
        ]
      });
    });
    Output is:
    Code:
    view focus()
    view el focus()
    view el focus
    setLastFocused()
    view el blur
    Problem #1:
    View on focus/blur not called

    Problem #2:
    When we call setLastFocused() (or if click on any row), view.el losses focus. This does not happen in version 4.1.1.

    -----
    firefox 18.0.2

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Vote Rating
    847
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


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

Thread Participants: 1