zoukankan      html  css  js  c++  java
  • EasyUI

    在网上查了很长时间没有找到解决方法,干脆自已查看一下代码来解决吧,随是压缩过的,不过也还是好查的,工夫不负有心人,终于解决了,方法如下:

    一、我们先让表格自适应宽度

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="UTF-8">
        <title>Basic DataGrid - jQuery EasyUI Demo</title>
        <link rel="stylesheet" type="text/css" href="../../themes/bootstrap/easyui.css">
        <link rel="stylesheet" type="text/css" href="../../themes/icon.css">
        <link rel="stylesheet" type="text/css" href="../demo.css">
        <script type="text/javascript" src="../../jquery.min.js"></script>
        <script type="text/javascript" src="../../jquery.easyui.min.js"></script>
    </head>
    <body>
        <h2>Basic DataGrid</h2>
        <div class="demo-info">
            <div class="demo-tip icon-tip"></div>
            <div>The DataGrid is created from markup, no JavaScript code needed.</div>
        </div>
        <div style="margin:10px 0;"></div>
    
        <table class="easyui-datagrid"
               data-options="singleSelect:true,collapsible:true,url:'datagrid_data1.json',method:'get',fitColumns:'true'">
            <thead>
                <tr>
                    <th data-options="field:'itemid',300">Item ID</th>
                    <th data-options="field:'productid',300">Product</th>
                    <th data-options="field:'listprice',300,align:'right'">List Price</th>
                    <th data-options="field:'unitcost',300,align:'right'">Unit Cost</th>
                    <th data-options="field:'attr1',300">Attribute</th>
                    <th data-options="field:'status',300,align:'center'">Status</th>
                </tr>
            </thead>
        </table>
        <script>
            $(window).resize(function () {
                $('#tt').datagrid('resize');
            });
        </script>
    </body>
    </html>

    二、修改jquery.easyui.min.js这个文件来解决滚动条问题

    function _4bf(_4c0){
    var opts=$.data(_4c0,"datagrid").options;
    var dc=$.data(_4c0,"datagrid").dc;
    var wrap=$.data(_4c0,"datagrid").panel;
    var _4c1=wrap.width()+20;
    var _4c2=wrap.height();
    var view=dc.view;
    var _4c3=dc.view1;
    var _4c4=dc.view2;
    var _4c5=_4c3.children("div.datagrid-header");
    var _4c6=_4c4.children("div.datagrid-header");
    var _4c7=_4c5.find("table");
    var _4c8=_4c6.find("table");
    view.width(_4c1);
    var _4c9=_4c5.children("div.datagrid-header-inner").show();
    _4c3.width(_4c9.find("table").width());
    if(!opts.showHeader){
    _4c9.hide();
    }

    可以看到我在 7001 行处加上了一个+20,这样让宽度正好覆盖滚动条

    大家如果有更好的方法留言给我呀

  • 相关阅读:
    DBS-Oracle:表的连接查询
    权益保护-产权保护-申请:如何撰写专利申请所需材料
    权益保护-产权保护:软件著作权
    权益保护-产权保护:专利申请
    Code-C#:手机号码验证
    软件-数据库-数据库管理工具-Navicat:百科
    WCF:目录
    WCF:百科
    ASP.NET Core-组件-后台任务:Hangfire
    ASP.NET Core-组件:目录
  • 原文地址:https://www.cnblogs.com/hantianwei/p/3440666.html
Copyright © 2011-2022 走看看