小智 5
我设法像这样修复它:
this.store = new Ext.data.Store({
listeners:{
'load':function (store, records, options) {
var restoreScroll = function(scrollState){
grid.getView().restoreScroll(scrollState);
};
if (grid.view && grid.view.scroller){
_.delay(restoreScroll, 10,grid.getView().getScrollState());
}
}
}, ...
}
Run Code Online (Sandbox Code Playgroud)
如您所见,我使用了 _.delay(来自 underscore.js 框架)。这就像一个setTimeout。
一个更优化的版本,不使用“restoreScroll”功能没有奏效。我认为在调用 restoreScroll 时视图会发生变化。我不得不花 10 毫秒。1 还不够。正如其他人所说,ext.js 使用了很多延迟调用。