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 分钟前
从零开始掌握C#核心:变量与数据类型
前端·c#
han_11 分钟前
前端高频面试题之Vuex篇
前端·vue.js·面试
qq_4152162533 分钟前
vue3搭建项目yarn+vue3+webpack+less+element-plus
前端·webpack·less
天天向上102436 分钟前
VueUse的使用
前端·vue.js·vscode
猪猪拆迁队2 小时前
前端图形引擎架构设计:双引擎架构设计
前端·后端·架构
宋辰月2 小时前
学习react第三天
前端·学习·react.js
bug总结2 小时前
更新原生小程序封装(新增缓存订阅)完美解决
前端·缓存·小程序
5335ld3 小时前
后端给的post 方法但是要求传表单数据格式(没有{})
开发语言·前端·javascript·vue.js·ecmascript
二川bro3 小时前
第33节:程序化生成与无限地形算法
前端·算法·3d·threejs
QDKuz3 小时前
掌握Vue2转Vue3, Options API 转 Composition API
前端·javascript·vue.js