首页 前端知识 JQuery EasyUI DataGrid行添加水印

JQuery EasyUI DataGrid行添加水印

2024-09-09 00:09:04 前端知识 前端哥 952 943 我要收藏

代码

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'
                            }));
                        }
                    });
                }

 

转载请注明出处或者链接地址:https://www.qianduange.cn//article/17948.html
标签
easyui
评论
发布的文章

关于HTML的知识

2024-09-18 23:09:36

js简单实现轮播图效果

2024-09-18 23:09:36

CSS3美化网页元素

2024-09-18 23:09:27

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!