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'

}));

}

});

}

相关推荐
二狗哈5 分钟前
Cesium快速入门22:fabric自定义着色器
运维·开发语言·前端·webgl·fabric·cesium·着色器
计算衎5 分钟前
FastAPI后端和VUE前端的数据交互原理详解
前端·vue.js·fastapi
黑岚樱梦6 分钟前
Linux系统编程
java·开发语言·前端
xrl20127 分钟前
ruoyi-vue2前端集成DMN规则引擎
前端·规则引擎·工作流·dmn
转转技术团队8 分钟前
前端工程化实践:打包工具的选择与思考
前端·javascript·webpack
前端郭德纲16 分钟前
React 19.2 已发布,现已上线 npm!
前端·react.js·npm
知其然亦知其所以然20 分钟前
JavaScript 变量的江湖恩怨:一篇文章彻底讲清楚
前端·javascript·面试
小番茄夫斯基22 分钟前
使用 pnpm + Workspaces 构建 Monorepo 的完整指南
前端·javascript·vue.js
翔云 OCR API22 分钟前
API让文档信息“活”起来:通用文档识别接口-开发者文字识别API
前端·数据库·人工智能·mysql·ocr
cypking23 分钟前
Web常见安全漏洞全解析(含案例+前后端实操防御方案)
前端