zoukankan      html  css  js  c++  java
  • demo示例的layui 分页

    一、主要是实现在自己特定的表格中的追加自己想要的数据。首先肯定是导入demo中的css和js文件,其次就是需要将innerHtml改成outerHTML,具体的区别自己去研究一下JavaScript官文文档。

    @*@model IEnumerable<Sbi.DataCenter.Dto.SupplierDto>*@
    @*<style type="text/css">
            #customers {
                font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
                 100%;
                border-collapse: collapse;
            }
    
                #customers td, #customers th {
                    font-size: 1em;
                    border: 1px solid #98bf21;
                    padding: 3px 7px 2px 7px;
                }
    
                #customers th {
                    font-size: 1.1em;
                    text-align: left;
                    padding-top: 5px;
                    padding-bottom: 4px;
                    background-color: #A7C942;
                    color: #ffffff;
                }
    
                #customers tr.alt td {
                    color: #000000;
                    background-color: #EAF2D3;
                }
        </style>*@
    
    <style asp-src="~/Sbi.DataCenter/Others/sku/common.css" at="Head"></style>
    <div class="row">
        <div class="form-group col mb-n1">
            <h1>@RenderTitleSegments(T["Supplier"])</h1>
            <h1></h1>
        </div>
        <div class="form-group col mb-n1">
            <div class="dropdown float-right order-md-1">
                <a asp-route-action="CreateSupplier" class="btn btn-primary float-right" role="button">@T["Add Supplier"]</a>
            </div>
        </div>
    </div>
    
    <form asp-action="Index">
        <table id="customers" align="left">
    
        </table>
    
        <div id="list-alert" class="alert alert-info d-none" role="alert">
            @T["<strong>Nothing here!</strong> Your search returned no results."]
        </div>
    </form>
    
    
    
    <div style="float:right;margin-right:200px;" id="demo20"></div>
    <style asp-src="~/Sbi.DataCenter/Styles/layui.css" at="Head"></style>
    
    <script asp-name="bootstrap" version="4" at="Foot"></script>
    <script asp-src="~/Sbi.DataCenter/Scripts/layui.all.js" at="Foot"></script>
    
    <script type="text/javascript" at="Foot">
        $(function () {
    
            layui.use(['laypage', 'layer'], function () {
                var laypage = layui.laypage
                    , layer = layui.layer;
    
                $.get("/Sbi.DataCenter/Supplier/GetDataList", {}, function (res) {
                    laypage.render({
                        elem: 'demo20'
                        , count: res.length
                        , limit: 20
                        , jump: function (obj) {
                            //模拟渲染
                            document.getElementById('customers').innerHTML = function () {
                                var tabel_heard = '<tr>';
                                tabel_heard += '<th style="text-align:center;">代号</th>';
                                tabel_heard += '<th style="text-align:center;">名称</th>';
                                tabel_heard += '<th style="text-align:center;">标志</th>';
                                tabel_heard += '<th style="text-align:center;">是否启用</th>';
                                tabel_heard += '<th style="text-align:center;">功能</th>';
                                tabel_heard += '</tr>';
                                var arr = []
                                    , thisData = res.concat().splice(obj.curr * obj.limit - obj.limit, obj.limit);
                                layui.each(thisData, function (index, res) {
                                    console.log(res);
                                    //alert(res.name);
                                    var option = "<tr align='center'><td>" + res.code + "</td><td> " + res.name + "</td><td>" + res.logo + "</td>";
                                    if (res.isActive) {
                                        option += " <td> <input type='checkbox' disabled='true' checked /> </td>";
                                    }
                                    else {
                                        option += "<td> <input type='checkbox' disabled='true' /> </td>";
                                    }
                                    option += " <td><a class='edit btn btn - primary btn - sm' href='/Sbi.DataCenter/Supplier/EditSupplier?id= " + res.id + "'>编辑</a> <a class='delete btn btn-danger btn-sm' href='/Sbi.DataCenter/Supplier/IsDeleted?id= " + res.id + "'onclick = 'if(confirm('确定删除吗?')==false)returnxa0false;'>删除</a ></td ></tr>";
                                    console.log(option);
                                    arr.push(option);
                                });
                                return tabel_heard+arr.join('');
                            }();
                        }
                    });
                });
    
            });
        })
    </script>
  • 相关阅读:
    routing路由模式
    MQ的订阅模式
    RabbitMq中的消息应答与持久化
    work工作消息队列Round-robin与Fair dispatch
    040 关于hive元数据的解析
    simple简单消息队列
    用户设置与virtual host配置
    Mq的介绍
    字典
    元组Tuple
  • 原文地址:https://www.cnblogs.com/wangjinya/p/11949200.html
Copyright © 2011-2022 走看看