ext 4.2 grid刷新后 滚动条位置不变
来源:互联网 发布:网盘 知乎 编辑:程序博客网 时间:2024/05/16 23:50
最近开发遇到问题,每次刷新grid的store之后,总是滚动到最前边,从网上搜到的方法是
在实时刷新的时候数据量过大会出现滚动条。这时候需要记录滚动条的位置。只需在grid的viewConfig属性里面添加如下参数
- onLoad : Ext.emptyFn,
- listeners : {
- beforerefresh : function(v) {
- v.scrollTop = v.scroller.dom.scrollTop;
- v.scrollHeight = v.scroller.dom.scrollHeight;
- },
- refresh : function(v) {
- v.scroller.dom.scrollTop = v.scrollTop
- + (v.scrollTop == 0
- ? 0
- : v.scroller.dom.scrollHeight
- - v.scrollHeight);
- }
- }
如果全部grid都想实现这个功能可以这样
- Ext.override(Ext.grid.GridView, {
- scrollTop : function() {
- this.scroller.dom.scrollTop = 0;
- this.scroller.dom.scrollLeft = 0;
- },
- scrollToTop : Ext.emptyFn
- });
解决方法是换成下边这样:红色标出
- onLoad : Ext.emptyFn,
- listeners : {
- beforerefresh : function(v) {
- v.scrollTop = v.el.dom.scrollTop;
- v.scrollHeight = v.el.dom.scrollHeight;
- },
- refresh : function(v) {
- v.el.dom.scrollTop = v.scrollTop
- + (v.scrollTop == 0
- ? 0
- : v.el.dom.scrollHeight
- - v.scrollHeight);
- }
- }
如果全部grid都想实现这个功能可以这样
- Ext.override(Ext.grid.GridView, {
- scrollTop : function() {
- this.el.dom.scrollTop = 0;
- this.el.dom.scrollLeft = 0;
- },
- scrollToTop : Ext.emptyFn
- });
0 0
- ext 4.2 grid刷新后 滚动条位置不变
- Ext Grid刷新后 滚动条位置不变
- 页面刷新后保持滚动条的位置不变
- 页面刷新后保持滚动条的位置不变
- asp.net页面刷新后的滚动条位置不变
- asp.net页面刷新后的滚动条位置不变
- asp.net页面刷新后的滚动条位置不变
- 用一句代码实现页面刷新后滚动条位置不变
- js实现网页刷新后滚动条位置不变
- grid panel 滚动条位置不变
- DIV层,刷新滚动条位置不变
- 网页刷新或者重新加载后滚动条的位置不变
- WinForm中的DataGrid控件在刷新后保持原滚动条位置不变
- 网页刷新或者重新加载后滚动条的位置不变
- 网页刷新或者重新加载后滚动条的位置不变
- javaScript刷新页面—滚动条位置不变的操作
- 页面刷新或者回发后DIV的滚动条位置不变!
- 网页刷新 页面位置不变(根据滚动条)
- Checked Exception and UnChecked Exception
- Linux 快捷键 备忘
- 字符串替换
- win8添加开机启动项
- 软件测试需要学习些什么技能
- ext 4.2 grid刷新后 滚动条位置不变
- 拥抱Spark,机遇无限——Spark Summit 2013精彩回顾
- maven乱码问题
- Regular Expression Matching
- ios性能分析和优化
- 建立samba服务器,还是别用win7吧
- c#获取项目路径的方法
- Log4J学习【七】Log4J的体系结构之docLayout的结构
- uiautomatorviewer出错记录