zoukankan      html  css  js  c++  java
  • EasyUI 1.4.4 DataGrid(大数据量) bufferview滚动时不加载下一页数据解决方案

      在使用Easyui DataGrid 过程中,发现若单页数据量超过300,IE浏览器加载速度很慢。也通过网上找寻了很多解决方案,最典型的就是去掉datagrid的自动列宽以及自动行高判断。

      1、解决自动列宽:  设定列宽度可解决。

      2、解决自动行高 : 注释掉下面的代码。

     1 function _3e(_44,_45){
     2 //for(var i=0;i<_45.length;i++){
     3 ////var tr1=$(_44[i]);
     4 ////var tr2=$(_45[i]);
     5 ////tr1.css("height","");
     6 ////tr2.css("height","");
     7 ////var _46=Math.max(tr1.height(),tr2.height());
     8 ////tr1.css("height",_46);
     9 ////tr2.css("height",_46);
    10 //}
    11 };

      使用上述两种解决办法后,加载速度有所改观,但效果不是很明显。后来使用了datagrid的scrollview和bufferview视图,scrollview效果仍然不太好,但使用了bufferview后,效果相当明显,最终选定使用bufferview来加载单页数据,速度虽然解决了,遇到了另外一个问题,原有的DataGrid做了分页处理,bufferview在滚动条拉到最底部时候,会自动加载下一页数据,我已经有了对datagrid的分页处理,所以这个功能不需要,经多次尝试,解决方案如下:

     1 function scrolling(){
     2             if (getDataHeight() < dc.body2.height() && view.renderedCount < state.data.total){
     3                 this.getRows.call(this, target, function(rows){
     4                     this.rows = rows;
     5                     this.populate.call(this, target);
     6                     dc.body2.triggerHandler('scroll.datagrid');
     7                 });
     8             } else if (dc.body2.scrollTop() >= getDataHeight() - dc.body2.height()) {
     9                 //  注释掉下面代码是为了滚动时不加载下一页数据
    10                 //this.getRows.call(this, target, function(rows){
    11                 //    this.rows = rows;
    12                 //    this.populate.call(this, target);
    13                 //});
    14             }
    15         }

      将scrolling方法中的else if 里面的代码块注释掉就可以了。

  • 相关阅读:
    tomcat配置
    java.net.ConnectException: Connection timed out: connect,java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.waitForConnect
    Tomat 下载地址
    Gradle的依赖方式——Lombok在Gradle中的正确配置姿势 本文来源:码农网 本文链接:https://www.codercto.com/a/70161.html
    mssql 那表语句
    监控系统搭建
    vue 子组件触发父组件方法的两种方式
    css margin边界叠加问题详谈
    sticky footer
    JS的构造函数
  • 原文地址:https://www.cnblogs.com/Chaser-Eagle/p/bufferview.html
Copyright © 2011-2022 走看看