W2ui 网格滚动
W2ui grid Scroll
我想在网格排序后滚动查看一条记录。这是我正在使用的:
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);
};
}
因为grid.sort()
执行完后,w2grid内部会执行grid.refresh()
,内部会执行一个延迟滚动:
setTimeout(function () { // allow to render first
obj.resize(); // needed for horizontal scroll to show (do not remove)
obj.scroll();
}, 1);
我想在网格排序后滚动查看一条记录。这是我正在使用的:
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);
};
}
因为grid.sort()
执行完后,w2grid内部会执行grid.refresh()
,内部会执行一个延迟滚动:
setTimeout(function () { // allow to render first
obj.resize(); // needed for horizontal scroll to show (do not remove)
obj.scroll();
}, 1);