zoukankan      html  css  js  c++  java
  • jeasyUI DataGrid 根据屏幕宽度自适应, 改变右侧滚动条Size

    PC浏览器的Datagrid可以显示多几列,但是在手机浏览器时,只能有选择性的显示前几列.

               $(window).resize(function () {
                    if (document.body.clientWidth <= 414) {
                        $('#grid').datagrid('hideColumn', 'id');
                        $('#grid').datagrid('hideColumn', 'prodCode');
                        $('#grid').datagrid('hideColumn', 'referee');
                        $('#grid').datagrid('hideColumn', 'createDate');
    
                    }
                    else { 
    
                        $('#grid').datagrid('showColumn', 'id');
                        $('#grid').datagrid('showColumn', 'prodCode');
                        $('#grid').datagrid('showColumn', 'referee');
                        $('#grid').datagrid('showColumn', 'createDate');
    
                    }
                });

     但是在chrome切换 PC/Mobile时, showColumn 每列的宽度不一样. 还没有设置列宽的方法.

    所以就不在(window).resize里写了.

    Datagrid的滚动条默认Size是18px,在手机上是很大的空白, 怎样改这个size呢?

     $('#grid').datagrid({
       ...
        scrollbarSize: (document.body.clientWidth <= 414?6:18),
       ...
    });
  • 相关阅读:
    去掉滚动条
    一些input用法
    jquery-ui datepicker
    js修改样式
    js时间
    跳转到页面的某个anchor
    事件传递
    flex对象.show()的时候display变成block
    html中传递信息
    button disable and enable
  • 原文地址:https://www.cnblogs.com/zitjubiz/p/9522970.html
Copyright © 2011-2022 走看看