zoukankan      html  css  js  c++  java
  • layui-table渲染不出来

    通过方法渲染

    页面代码:

    <table id="tableList" lay-filter="clublist"></table>

    js代码:

    layui.use('table', function () {
        var table = layui.table;
    
        //返回的数据必须是code:0
        var tableIns = table.render({
            elem: '#tableList'
          , height: 450
          , url: '/admin/Club/Club.ashx' //数据接口
          , where: { action: 'getclublistbypage' }
          , page: true //开启分页
          , limit: 10
          , cols: [[ //表头
            { field: 'ID', title: 'ID',  80, sort: true, fixed: 'left' }
            , { field: 'ClubName', title: '主办方名称',  180 }
            , { field: 'ClubIntro', title: '主办方介绍',  180 }
            , { field: 'ClubLogo', title: '主办方logo',  180 }
            , { field: 'IsDel', title: '是否可用',  120 }
            , { field: 'SponsorTypeID', title: '主办方类型',  180 }
          ]]
        });
    
    });

    然后是接口返回的数据(使用官方的默认response)

    {
      code: 0,
      msg: "",
      count: 1000,
      data: []
    } 

    要注意,其中code的值,官方是这么说的:

    我理解的就是code反应的是你返回的数据是正确的还是错误的,假如不正确(不为0),那么页面会一直渲染不出来,这个要注意,这个问题搞了半天

  • 相关阅读:
    本月周六周日LIST集合
    c#动态调用WEBSERVICE接口
    c#调用
    web上传下载文件
    MVC 的知识
    MongoDB 无法创建抽象类的问题,
    并行活动
    C# 字符串计算表达式
    c# 将字符串转换为逻辑表达式(字符串转换布尔)
    C# 中间语言、CLR、CTS、CLS
  • 原文地址:https://www.cnblogs.com/zhyue93/p/layui-table-1.html
Copyright © 2011-2022 走看看