PDA

View Full Version : [DUP] DataView scrolls to the top in IE when selecting an item



oklymenko
13 Jan 2014, 3:04 PM
Ext version tested:

Ext 4.1.3
Ext 4.2.2
Browser versions tested against:

IE9
IE11
Description:

When selecting an item in a dava view using IE, the dataview always gets scrolled to the top
Steps to reproduce the problem:

Go to Sencha Docs: http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.view.View
Click on Live Preview on top of the example code in the Ext.view.View class summary description
Scroll the data view to the bottom
Click on the last item to select it.
The result that was expected:

the data view does not scroll
The result that occurs instead:

the dataview scrolls to the top, I cannot see the item I just selected

Gary Schlosberg
13 Jan 2014, 4:10 PM
Thanks for the report! I have opened a bug in our bug tracker.

germanicus
13 Jan 2014, 4:14 PM
This has already been fixed. Try this override:



Ext.define('EXTJSIV-11789.view.View', {
override: 'Ext.view.View',

focusNode: function(rec){
var me = this,
node = me.getNode(rec, true),
el = me.el,
adjustmentY = 0,
adjustmentX = 0,
elRegion = el.getRegion(),
nodeRegion;

// Viewable region must not include scrollbars, so use
// DOM client dimensions
elRegion.bottom = elRegion.top + el.dom.clientHeight;
elRegion.right = elRegion.left + el.dom.clientWidth;
if (node) {
nodeRegion = Ext.fly(node).getRegion();
// node is above
if (nodeRegion.top < elRegion.top) {
adjustmentY =nodeRegion.top - elRegion.top;
// node is below
} else if (nodeRegion.bottom > elRegion.bottom) {
adjustmentY = nodeRegion.bottom - elRegion.bottom;
}

// node is left
if (nodeRegion.left < elRegion.left) {
adjustmentX =nodeRegion.left - elRegion.left;
// node is right
} else if (nodeRegion.right > elRegion.right) {
adjustmentX = nodeRegion.right - elRegion.right;
}

if (adjustmentX || adjustmentY) {
me.scrollBy(adjustmentX, adjustmentY, false);
}

// Poke on a tabIndex to make the node focusable.
Ext.fly(node).set({
tabIndex: -1
});

node.focus();
}
}
});

oklymenko
14 Jan 2014, 5:48 AM
Thanks, the override worked great.

kbesbes
28 Jun 2016, 5:54 AM
This happening again in 5.1.3