Let's go

LayUI相关

一、layui数据表格隔行变色,单击行增加背景色

    //定义点击事件
    table.on('row(gridTable)', function (obj) {
        var datas = table.cache["gridTable"];
        //隔行换色,显示当前行
        for (var i = 0; i < datas.length; i++)//countNum为总行数
        {
            if (i % 2 == 0) { //设置隔行换色
                $("[lay-id='gridTable'] tbody tr[data-index=" + i + "]").attr({ "style": "background:#D1EEEE;color:#666666" });//恢复原有tr颜色
            } else {
                $("[lay-id='gridTable'] tbody tr[data-index=" + i + "]").attr({ "style": "background:#fff;color:#666666" });//恢复原有tr颜色
            }
        }
        $(this).attr({ "style": "background-color:#1E9FFF;color:#ffffff" });

        var data = obj.data.baseInfoId; // 获得当前行数据
        table.reload('gridTable1', {
            url: "/Report_Areas/JDBaseInfo/GetJDBaseDataList?t=" + new Date(),
            where:
            {
                baseInfoId: data
            },
            page: { curr: 1 }
        });
    });

 

二、提示框

layer.msg('保存成功!', { icon: 6 });// icon:1 绿对号 icon:2 红叉号 icon:3黄问号 icon:4 灰色锁 icon:5 红哭脸 icon:6 绿笑脸 icon:7 黄叹号

 

 

其他

posted @ 2020-12-31 10:25  chenze  阅读(177)  评论(0编辑  收藏  举报
有事您Q我