• layuiTable根据返回的JSON内容改变指定行的颜色


     1         // 渲染表格
     2         var insTb = table.render({
     3             elem: '#tableArticles',
     4             //url: '../../json/loginRecord.json',
     5             url: '{:url('hospital/index')}',
     6             limit: 10,
     7             page: true,
     8             cellMinWidth: 100,
     9             title: '预约列表',
    10             cols: [[
    11                 {field:'name',title: '姓名',80,align: 'center'},
    12                 {field:'sex',title: '性别',60,align: 'center'},
    13                 {field:'old', title: '年龄',60,align: 'center'},
    14                 {field:'tel', title: '电话',120,align: 'center'},
    15                 {field:'address', title: '地址',100,align: 'center'},
    16                 {field:'m_type', title: '病患类型',align: 'center'},
    17                 {field:'doctor_num', title: '专家号',80,align: 'center'},
    18                 {field:'doctor', sort: true,title: '专家'},
    19                 {field:'con',title: '咨询内容'},
    20                 {
    21                     field: 'status', align: 'center',80, templet: function (d) {
    22                         var strs = ['等待','已到诊'];
    23                         return strs[d.status];
    24                     }, title: '状态'
    25                 },
    26                 {field:'view_time',title: '预约时间'},
    27                 {field:'depart',title: '部门'},
    28                 {field:'media',title: '媒体'},
    29                 {field:'service',title: '客服'},
    30                 {field:'jjbs',title: '竞价标识'},
    31                 {align:'center', toolbar: '#tableBarArticles', title: '操作', minWidth: 160,fixed: 'right'}
    32             ]],
    33             done: function (response) {
    34                //定位当前table视图
    35                var tableView = this.elem.next();
    36                 //response.data获取后端返回的JSON格式数据
    37                $.each(response.data,function (index,item) {
    38                     //逻辑判断
    39                    if(item.status == "1"){
    40                         //改变TR标签内字体颜色
    41                        tableView.find('tbody tr[data-index="'+ index +'"]').css('color','red');
    42                    }
    43                })
    44             }
    45         });
  • 相关阅读:
    20180130工作总结
    高并发情况利用锁机制处理缓存未命中
    Git学习(二)
    Git学习(一)
    Navicat运行sql文件报错out of memory
    Windows中杀死某个端口的进程
    Git入门基本操作
    MySQL数据库安装与配置详解
    用户模块开发
    数据库系列学习(三)-数据的增、删、改
  • 原文地址:https://www.cnblogs.com/lgx5/p/16056411.html
Copyright © 2020-2023  润新知