• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

LayUI 表单添加合计行的操作

武飞扬头像
小猿学码
帮助1

将合计字段加入到想要添加的的列的末尾,只需要在此列渲染中加入 

totalRowText: "合计"

在想要计算合计列的渲染中加入

totalRow: true

即可实现增加表单合计金额的计算

具体代码示例和效果展示如下

  1.  
    table.render({
  2.  
    elem: '#checkForDetail-consumeInfo',
  3.  
    // url: layui.setter.ringpaiPhisHost '/biz/platform/dzMessage/findSumMessage?access_token=' localData["access_token"] ,
  4.  
    data: tableData
  5.  
    , title: '用户表'
  6.  
    , limit: 10 // 每页默认数量
  7.  
    , limits: [10,20,30,50,100]
  8.  
    , sort: true
  9.  
    , page: true
  10.  
    , drag: false
  11.  
    ,totalRow: true // 开启合计行
  12.  
    , count: res.count
  13.  
    , childTablePaddingLeft: "30px"
  14.  
    , cols: [[ //表头
  15.  
    {field: 'startTime', title: '结账开始时间', align: 'center', width: 160, totalRowText:"合计:"}
  16.  
    , {field: 'endTime', title: '结账结束时间', align: 'center', width: 160}
  17.  
    , {field: 'payType', title: '业务方', align: 'center', width: 80}
  18.  
    , {field: 'cashPrice', title: 'a', align: 'center', width: 100 ,totalRow: true}
  19.  
    , {field: 'alipayPrice', title: 'b', align: 'center', width: 100,totalRow: true}
  20.  
    , {field: 'wechatPrice', title: 'c', align: 'center', width: 100,totalRow: true}
  21.  
    , {field: 'meiTuanPrice', title: 'd', align: 'center', width: 100,totalRow: true}
  22.  
    , {field: 'likePrice', title: 'e', align: 'center', width: 100,totalRow: true}
  23.  
    , {
  24.  
    field: 'right',
  25.  
    title: '操作',
  26.  
    width: 200,
  27.  
    align: 'center',
  28.  
    toolbar: '#TableToolbar'
  29.  
    },
  30.  
     
  31.  
    ]], done: function (d) {
  32.  
     
  33.  
    merge(d)
  34.  
    }
  35.  
    , height: 700
  36.  
    });
学新通

学新通

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhghecjg
系列文章
更多 icon
同类精品
更多 icon
继续加载