KenSave Grid在onSave之后跳到顶部 [英] Kendo Grid jumps to top after onSave

查看:73
本文介绍了KenSave Grid在onSave之后跳到顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要设置的网格:

I have a grid that i need to set:

scrollable: {
    virtual: true
},

当用户编辑单元格时,将更新(或onSave(e))其更改.网格重置回到页面顶部.我不知道为什么用户每次尝试更改单元格内容时都会失去位置.

When users edit a cell then updates (or onSave(e)) their changes. The grid resets back to the top of the page. I don't know why. Users lose their place every time they try to change a cells contents.

当我做

scrollable: false, 

它保持不变.我认为这是Telerik Kendo中的一个巨大错误.有没有人想出保存更改后如何留在网格上?

it stays put. I think this is a huge bug in Telerik Kendo. Has anyone figured out how to stay in place on the grid after saving changes?

更新

仅在IE 11中会出现此问题.不幸的是,我的客户端只能使用IE11.

This problem only occurs in IE 11. Unfortunately my client can only use IE11.

推荐答案

答案是在绑定之前保存您的当前位置.

The answer is to save your current location before you bind.

onGridBinding(){
    _currentLeftPosition = $(".k-virtual-scrollable-wrap").scrollLeft();
}

in onGridBound(){
    //Go Back to previous position
    var vs = mainGrid.wrapper.find('.k-grid-content').data('kendoVirtualScrollable');
    var scrollGridContentOffsetTop = mainGrid.wrapper.find('.k-grid-content').offset().top;
    var selectContentOffsetTop = mainGrid.content.offset().top;
    var distanceTop = selectContentOffsetTop - scrollGridContentOffsetTop;
    var scrollTop = vs.verticalScrollbar.scrollTop();
    $("#mainGrid div.k-virtual-scrollable-wrap").animate({scrollTop: distanceTop + scrollTop,scrollLeft: _currentLeftPosition}, 0);
    $("#mainGrid div.k-scrollbar-vertical").animate({scrollTop: distanceTop + scrollTop}, 0);
}

这篇关于KenSave Grid在onSave之后跳到顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆