• easyUI框架之学习3--表格datagrid


    @model MVCEasyUI.Models.Sale.PageResult<MVCEasyUI.Models.Sale.Order>
    @{
    ViewBag.Title = "AddSaleOrder";
    }
    <!DOCTYPE html>
    <html>
    <head >
    <link href="~/Scripts/easyUI/themes/default/easyui.css" rel="stylesheet" />
    <link href="~/Scripts/easyUI/themes/icon.css" rel="stylesheet" />
    <script src="~/Scripts/easyUI/jquery-1.7.2.min.js"></script>
    <script src="~/Scripts/easyUI/jquery.easyui.min.js"></script>
    <script src="~/Scripts/easyUI/locale/easyui-lang-zh_CN.js"></script>
    <script >
    var _id = 1;
    $(function () {

    }); function AppendRow() {
    _id++;
    var objId = 'tmp_' + _id;
    var tmp = "<div id=" + objId + "><a href='#' class='easyui-linkbutton' data-options='iconCls:"icon-remove"' >删除</a> <a href='#' class='easyui-linkbutton' data-options='iconCls:"icon-edit"' >编辑</a></div>";
     
    $('#OrderList').datagrid('appendRow', {
    CorId: 0,
    PlatfromId: 1,
    ShopId: 2,
    Opr:tmp
    });
    var obj = $("#" + objId);
    $.parser.parse(obj);

    }

    function DeleteRow() {
    var row = $('#OrderList').datagrid('getSelected');
    alert(row);
    if (row) {
    var index = $('#OrderList').datagrid('getRowIndex', row);
    $('#OrderList').datagrid('deleteRow', index);
    }
    }


    </script>
    </head>

    <body >
    <h2>@Model.ResultName</h2>
    <a href="#" onclick ="AppendRow()">添加一行</a>
    <table id="OrderList" class="easyui-datagrid">
    <thead >
    <tr >
    <th data-options="field:'CorId'">商家ID</th>
    <th data-options="field:'PlatfromId'">平台ID</th>
    <th data-options="field:'ShopId'">店铺ID</th>
    <th data-options="field:'TreadId'">交易编号</th>
    <th data-options="field:'TreadTime'">交易时间</th>
    <th data-options="field:'Opr'">操作</th>
    </tr>

    </thead>
    <tbody >
    @foreach (var order in Model.ResultList)
    {
    <tr id="Id@{@order.Id}">
    <td id="CorId_@order.CorId">@order.CorId </td>
    <td><a id="PlatfromId_@order.PlatfromId" href ="#">@order.PlatfromId </a></td>
    <td><a id="ShopId_@order.ShopId" href ="#">@order.ShopId</a> </td>
    <td>@order.TreadId </td>
    <td>@order.TreadTime </td>
    <td> <a href="javascript:;" class="easyui-linkbutton" data-options="iconCls:'icon-remove'" onclick='DeleteRow()'>删除</a>
    <a href="javascript:;" class="easyui-linkbutton" data-options="iconCls:'icon-edit'" onclick=''>编辑</a>

    </td>
    </tr>
    }
    </tbody>

    </table>
    </body>
    </html>

  • 相关阅读:
    Word 操作类库
    Windows服务卸载之后未重启机器之前再安装问题
    Word转Html
    Centos7下配置Python3和Python2共存,以及对应版本Ipython安装配置
    Linux 和Windows之间命令行实现目录或文件互传
    centos下卸载OpenJDK 并安装sun的jdk
    bridged(桥接模式)、NAT(网络地址转换模式)和hostonly(主机模式)VMware下三种网络配置方式
    关于centos启动报错:Failed to start Crash recovery kernel arming的解决方案
    centos7下固定IP(静态IP)网络配置
    【分享】BUG从诞生到灭亡——处理BUG的流程
  • 原文地址:https://www.cnblogs.com/zhshlimi/p/5001005.html
Copyright © 2020-2023  润新知