我想在对网格进行排序后滚动查看记录。这就是我正在使用的:
onSort: function(event) {
event.onComplete = function () {
w2ui.grid.scrollIntoView(10);
}
}
我想在对网格进行排序后滚动查看记录。这就是我正在使用的:
onSort: function(event) {
event.onComplete = function () {
w2ui.grid.scrollIntoView(10);
}
}
你需要延迟scrollIntoView()
https://jsfiddle.net/zxcgxkxa/1/
onSort: function(event) {
event.onComplete = function () {
setTimeout(function(){
w2ui.grid.scrollIntoView(10);
}, 10);
};
}
因为 aftergrid.sort()
被执行,w2grid 将在内部执行grid.refresh()
,它在内部执行延迟滚动:
setTimeout(function () { // allow to render first
obj.resize(); // needed for horizontal scroll to show (do not remove)
obj.scroll();
}, 1);