zoukankan      html  css  js  c++  java
  • jquery easy ui 学习 (7) TreeGrid Actions

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="UTF-8">
        <title>TreeGrid Actions - jQuery EasyUI Demo</title>
        <link rel="stylesheet" type="text/css" href="../../themes/default/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>TreeGrid Actions</h2>
        <p>Click the buttons below to perform actions.</p>
        <div style="margin:20px 0;">
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="collapseAll()">CollapseAll</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="expandAll()">ExpandAll</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="expandTo()">ExpandTo</a>
        </div>
        <table id="tg" class="easyui-treegrid" title="TreeGrid Actions" style="700px;height:250px"
                
                data-options="
                    iconCls: 'icon-ok',
                    rownumbers: true,
                    animate: true,
                    collapsible: true,
                    fitColumns: true,
                    url: 'treegrid_data2.json',
                    method: 'get',
                    idField: 'id',
                    treeField: 'name'
                ">
                
            <thead>
                <tr>
                    <th data-options="field:'name',180">Task Name</th>
                    <th data-options="field:'persons',60,align:'right'">Persons</th>
                    <th data-options="field:'begin',80">Begin Date</th>
                    <th data-options="field:'end',80">End Date</th>
                    <th data-options="field:'progress',120,formatter:formatProgress">Progress</th>
                </tr>
            </thead>
        </table>
        <script type="text/javascript">
            function formatProgress(value){
                if (value){
                    var s = '<div style="100%;border:1px solid #ccc">' +
                            '<div style="' + value + '%;background:#cc0000;color:#fff">' + value + '%' + '</div>'
                            '</div>';
                    return s;
                } else {
                    return '';
                }
            }
            function collapseAll(){
                $('#tg').treegrid('collapseAll');
            }
            function expandAll(){
                $('#tg').treegrid('expandAll');
            }
            function expandTo(){
                $('#tg').treegrid('expandTo',21).treegrid('select',21);
            }
        </script>
    </body>
    </html>


    json文件
    {"total":7,"rows":[
        {"id":1,"name":"All Tasks","begin":"3/4/2010","end":"3/20/2010","progress":60,"iconCls":"icon-ok"},
        {"id":2,"name":"Designing","begin":"3/4/2010","end":"3/10/2010","progress":100,"_parentId":1,"state":"closed"},
        {"id":21,"name":"Database","persons":2,"begin":"3/4/2010","end":"3/6/2010","progress":100,"_parentId":2},
        {"id":22,"name":"UML","persons":1,"begin":"3/7/2010","end":"3/8/2010","progress":100,"_parentId":2},
        {"id":23,"name":"Export Document","persons":1,"begin":"3/9/2010","end":"3/10/2010","progress":100,"_parentId":2},
        {"id":3,"name":"Coding","persons":2,"begin":"3/11/2010","end":"3/18/2010","progress":80},
        {"id":4,"name":"Testing","persons":1,"begin":"3/19/2010","end":"3/20/2010","progress":20}
    ],"footer":[
        {"name":"Total Persons:","persons":7,"iconCls":"icon-sum"}
    ]}
    
    
    
    
    
    
    
  • 相关阅读:
    【Neo4j cypher命令】 使用
    【Neo4j】 Neo4j数据插入的几种方式总结
    【Ubuntu】 解决 无法获得锁 /var/lib/dpkg/lock-frontend
    【python】win10配置pycharm 关于Error processing line 7 of D:softwaresAnaconda3libsite-packagespywin32.pth 问题的解决
    win10环境配置XShell6.0绿色版
    【python】 Anaconda3配置好后,启动jupyter服务异常的解决方法
    利用python+win32api获取标题对应的窗口句柄id,并且操作为当前活动窗口
    利用python+win32获取windows中任务中所有的窗口标题
    C++核心知识
    C++基础知识
  • 原文地址:https://www.cnblogs.com/timelesszhuang/p/3686045.html
Copyright © 2011-2022 走看看