gtnotgod

LayUI:使用小结

动态表格:

隐藏某列不显示,但是可以通过开关让其显示与隐藏:

所以在layui2.4版本的时候,layui的cols的参数新添了hide(隐藏)属性。

{field:\'cust_id\', title: \'ID\', hide:true}

 

对于字段内容展示的控制:templet字段控制  ||  function 获取的是当前列的整体数据

  {
                field: \'state\',
                title: \'处理状态\',
                width: 90, templet: function change(d) {
                    if (d.state == 1)
                        return "有效"
                    else
                        return "无效"
                }
   }

时间类型字段格式化: layui.util.toDateString(data.时间字段)||

宽度与排序{width: 130,sort: true}  

       {
                field: \'accept_time\',
                title: \'accept_time\',
                width: 180,templet:function push_time(d){
                    if(d.accept_time==null)
                        return "";
                    else
                        return  layui.util.toDateString(d.accept_time)
                }
            }

动态下拉框可以使用ajax,初始化操作dom

 

分类:

技术点:

相关文章:

  • 2022-01-17
  • 2021-05-01
  • 2021-09-02
  • 2021-12-07
  • 2021-09-05
  • 2021-11-20
  • 2021-12-04
猜你喜欢
  • 2021-11-07
  • 2021-12-15
  • 2021-12-26
  • 2021-11-30
  • 2021-12-10
  • 2021-12-25
  • 2021-11-12
相关资源
相似解决方案