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'

}));

}

});

}

相关推荐
我爱学习_zwj17 小时前
【鸿蒙进阶-7】鸿蒙与web混合开发
前端·华为·harmonyos
小谭鸡米花17 小时前
高德地图电子围栏/地图选区/地图打点
前端·javascript·vue.js
摆烂工程师17 小时前
什么是 ChatGPT Business 会员?与 ChatGPT Plus 有什么不同?
前端·后端·程序员
闲不住的李先森17 小时前
使用Context7:告别AI“幻觉”,让编程助手永远生成最新、可用的代码
前端·ai编程·cursor
西瓜树枝17 小时前
解决 JS 大整数精度丢失?一文读懂 BigInt 的底层逻辑与实战规则
前端·javascript
刺客_Andy17 小时前
React 第四十六节 Router中useInRouterContext的使用详细介绍及注意事项
前端·javascript·react.js
刺客_Andy17 小时前
React 第四十四节Router中 usefetcher的使用详解及注意事项
前端·javascript·react.js
该用户已不存在18 小时前
我的Python工具箱,不用加班的秘密
前端·后端·python
刺客_Andy18 小时前
React 第四十五节 Router 中 useHref() Hook的使用详解及注意事项
前端·javascript·react.js
好好好明天会更好18 小时前
Vue2中页面数据响应的问题
前端·javascript·vue.js