JQuery EasyUI DataGrid行添加水印

代码

复制代码
css:
.water-mark::after {
        content: '有异议';
        position: absolute;
        left: 460px;
        top: 40px;
        color: rgb(255 0 0);
        transform: rotate(-25deg);
        pointer-events: none;
        z-index: 10;
    }
js:
$('#dgData').datagrid({
                loadMsg: '数据加载中,请稍后......',
                // fitColumns: true,
                autoRowHeight: false,
                height: $(window).height() - 18,
                rownumbers: true,
                striped: true,
                cache: false,
                singleSelect: true,
                pagination: true,
                loadFilter: pagerFilter,
                pageSize: 60,
                pageList: [100, 150, 200],
                toolbar: '#tb',
                columns: cols,
                onLoadSuccess: function (data) {
                    // 遍历所有行,为它们添加水印样式
                    var body = $(this).data().datagrid.dc.body2;
                    body.find('table tbody tr').each(function (index, item) {
                        let h = ((index + 1) * 33.5);
                        if ($(this).find("td:eq(4)").text().includes("撤销申诉")) {
                            //$(this).addClass('water-mark');
                            $(this).after($('<span>有异议<span>').css({
                                'content': '有异议',
                                'position': 'absolute',
                                'left': '460px',
                                'top': h + 'px',
                                'border': '1px solid red',
                                'color': 'rgb(255 0 0)',
                                'transform': 'rotate(-5deg)',
                                'pointer- events': 'none',
                                'z-index': 'none'
                            }));
                        }
                    });
                }
            });
        },

主要代码

onLoadSuccess: function (data) {

// 遍历所有行,为它们添加水印样式

var body = $(this).data().datagrid.dc.body2;

body.find('table tbody tr').each(function (index, item) {

let h = ((index + 1) * 33.5);//设置定位高度

if ($(this).find("td:eq(4)").text().includes("撤销申诉")) {

//控制条件,满足条件after 追加dom元素

(this).after(('<span>有异议<span>').css({

'content': '有异议',

'position': 'absolute',

'left': '460px',

'top': h + 'px',

'border': '1px solid red',

'color': 'rgb(255 0 0)',

'transform': 'rotate(-5deg)',

'pointer- events': 'none',

'z-index': 'none'

}));

}

});

}

相关推荐
神の愛1 天前
左连接查询数据 left join
java·服务器·前端
小码哥_常1 天前
解锁Android嵌入式照片选择器,让你的App体验丝滑起飞
前端
郑寿昌1 天前
IIoT本体迁移的领域扩展机制
服务器·前端·microsoft
深海鱼在掘金1 天前
Next.js从入门到实战保姆级教程(第十一章):错误处理与加载状态
前端·typescript·next.js
深海鱼在掘金1 天前
Next.js从入门到实战保姆级教程(第十二章):认证鉴权与中间件
前端·typescript·next.js
energy_DT1 天前
2026年十五五油气田智能增产装备数字孪生,CIMPro孪大师赋能“流动增产工厂”三维可视化管控
前端
龙猫里的小梅啊1 天前
CSS(四)CSS文本属性
前端·css
MXN_小南学前端1 天前
watch详解:与computed 对比以及 Vue2 / Vue3 区别
前端·javascript·vue.js
饭小猿人1 天前
Flutter实现底部动画弹窗有两种方式
开发语言·前端·flutter
让学习成为一种生活方式1 天前
pbtk v 3.5.0安装与使用--生信工具084
前端·chrome