zoukankan      html  css  js  c++  java
  • 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>

  • 相关阅读:
    页面滚屏截图工具推荐
    java总结第二次(剩余内容)//类和对象1
    happy birthday to tbdd tomorrow
    数组增删改查及冒泡
    三个循环方面程序
    三个入门小程序
    java总结第二次//数组及面向对象
    Java总结第一次//有些图片未显示,文章包含基础java语言及各种语句
    后台验证url是不是有效的链接
    img 鼠标滑上后图片放大,滑下后图片复原
  • 原文地址:https://www.cnblogs.com/zhshlimi/p/5001005.html
Copyright © 2011-2022 走看看