• (转)combogrid的代码实例


    EasyUI中combogrid的代码实例

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>combogrid</title>
    <link rel="stylesheet" type="text/css" href="themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="themes/icon.css">
    <script type="text/javascript" src="jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="jquery.easyui.min.js"></script>
    <script>
    $(function(){
    $("#cc").combogrid({
    panelWidth:400,
    value:'safds',//缺省值
    idField:"code",
    textField:"name",
    url:"datagrid_data.json",
    columns:[[
    {field:'code',title:'Code',60},
    {field:'name',title:'Name',100},
    {field:'addr',title:'Address',120},
    {field:'col4',title:'Col41',100}
    ]]
    });
    });
    //重新加载数据源
    function reload(){
    $('#cc').combogrid('grid').datagrid('reload');
    }

    //设置select中的值
    function setValue(){
    $("#cc").combogrid("setValue","003");
    }
    //获取下拉列表中选择的值
    function getValue(){
    var val = $('#cc').combogrid('getValue');
    alert(val);
    }
    //禁用组件
    function disable(){
    $('#cc').combogrid('disable');
    }
    //启用组件
    function enable(){
    $('#cc').combogrid('enable');
    }
    //获取选中的表格的数据
    function getGridValue(){
    var grid=$("#cc").combogrid("grid");//获取表格对象
    var row = grid.datagrid('getSelected');//获取行数据
    alert("选择的grid中的数据如下:code:"+row.code+" name:"+row.name+" addr:"+row.addr+" col4:"+row.col4);
    }
    function clear(){
    $("#cc").combogrid("clear");
    }
    </script>
    </head>

    <body>
    <h3>combogrid</h3>
    <div style="margin:10px 0;">
    <a href="#" class="easyui-linkbutton" onclick="reload()">Reload</a>
    <a href="#" class="easyui-linkbutton" onclick="setValue()">SetValue</a>
    <a href="#" class="easyui-linkbutton" onclick="getValue()">GetValue</a>
    <a href="#" class="easyui-linkbutton" onclick="getGridValue()">GetGridValue</a>
    <a href="#" class="easyui-linkbutton" onclick="disable()">Disable</a>
    <a href="#" class="easyui-linkbutton" onclick="enable()">Enable</a>
    <a href="#" class="easyui-linkbutton" onclick="clear()">clear</a>
    </div>
    <select id="cc" class="easyui-combogrid" style="250px;"></select>
    </body>
    </html>

     
  • 相关阅读:
    矩阵快速幂模板
    Kuangbin带你飞 AC自动机
    Kuangbin 带你飞 KMP扩展KMP Manacher
    Kuangbin 带你飞 数位DP题解
    kuangbin 带你飞 数学基础
    Kuangbin 带你飞-基础计算几何专题 题解
    最大团问题
    头文件
    Codeforces 362E Petya and Pipes 费用流建图
    kuangbin带你飞 匹配问题 二分匹配 + 二分图多重匹配 + 二分图最大权匹配 + 一般图匹配带花树
  • 原文地址:https://www.cnblogs.com/solocao/p/3670214.html
Copyright © 2020-2023  润新知