I\'m looking for a way to scroll to a specific element in a Tree. Any idea how to do this ?
The DOM scrollIntoView doesn't really work as expected as it always either top or bottom aligns the element. ExtJS however seems to have just what is needed:
Ext.get(el|elId).scrollIntoView(containerId|containerEl);
For example, to ensure the currently selected item in an Ext.view.View (dataview) instance is visible, I did:
Ext.define('MyView', {
extend: 'Ext.view.View',
...
listeners: {
'selectionchange': function(_, selections) {
if (selections.length === 1) {
var node = this.getNode(selections[0]);
Ext.fly(node).scrollIntoView(this.el);
}
}
},
...
}