问题
I am facing a very strange problem. I have a grid and when i CLICK on any row then grid automatically goes to first record, though the row on which i click is selected but not focused.
The problem is strange because when i used that same grid as an example then there was no problem and everything works fine.
I really dont understand what could cause this problem? i haven't overridden any listeners to scroll to top either.
回答1:
i had following in my code which was causing it so remove this:
Ext.override(Ext.grid.GridView, {
syncFocusEl : Ext.emptyFn
});
回答2:
This doesn't work with ExtJs 4.0. I've got it working with the following. I haven't fully tested for unexpected side effects.
Ext.override(Ext.selection.RowModel, {
onRowMouseDown: function (view, record, item, index, e) {
this.selectWithEvent(record, e);
}
});
The original method looks like this:
onRowMouseDown: function(view, record, item, index, e) {
view.el.focus();
this.selectWithEvent(record, e);
}
来源:https://stackoverflow.com/questions/3784014/grid-scrolls-to-top-when-any-row-is-clicked-in-ext-js