有行列冻结的报表,鼠标悬停变色,标题不变怎么做?

这个报表第一列是冻结的,我设置了JS使鼠标悬浮时变红色,标题不变,但是预览后,冻结的第一列可以实现鼠悬浮标题不变色,但是如果鼠标从后面的几列网上移,移到标题,这时候标题就会变色,要怎样实现,不管鼠标从哪网上移到标题,标题都不变色呢?

微信图片_20210621140201.png

FineReport 坚果联盟 发布于 2021-6-21 14:07
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共1回答
最佳回答
0
shirokoLv6资深互助
发布于2021-6-21 14:11(编辑于 2021-6-21 14:49)

https://help.fanruan.com/finereport/doc-view-1625.html

2.6

image.png

---

看不懂啥玩意。。自己写一个。

/*新的背景颜色*/

var background_color = "rgb(255,0,0)";

/*遍历计数器*/

var i = 0;

/* 首行除外,tr:gt(0)定位首行,索引从0开始,标题行为多行时注意此位置代码要做相应修改*/

$('.x-table tr:gt(1)') .bind("mouseenter", function () {

$(this).children("td").each(function () {

/*是否已变色*/

if($(this).attr('old-bgcolor')){

}

else{

/*单元格记录原始色*/

$(this).attr('old-bgcolor', $(this).css('background-color'));

$(this).css('background-color', background_color);

}

});

});

$('.x-table tr:gt(1)') .bind("mouseleave", function () {

$(this).children("td").each(function () {

/*是否已变色*/

if($(this).attr('old-bgcolor')){

$(this).css('background-color', $(this).attr('old-bgcolor'));

/*单元格去除原始色*/

$(this).attr('old-bgcolor','');

}

else{

}

});

    });

  • 坚果联盟 坚果联盟(提问者) 我就是照着这个文档做的,如果没有冻结列,就行,有冻结列,就会出现我上面描述的问题
    2021-06-21 14:15 
  • StudyYL StudyYL 回复 坚果联盟(提问者) $(\'.x-table tr:gt(0)\')这两个地方改成$(\'.x-table tr:gt(1)\')试试
    2021-06-21 14:23 
  • shiroko shiroko 回复 坚果联盟(提问者) 试一下
    2021-06-21 15:00 
  • 坚果联盟 坚果联盟(提问者) 回复 StudyYL 试了,不起作用
    2021-06-24 10:33 
  • StudyYL StudyYL 回复 坚果联盟(提问者) 上传一下你的模板,看看
    2021-06-24 13:23 
  • 3关注人数
  • 830浏览人数
  • 最后回答于:2021-6-21 14:49
    请选择关闭问题的原因
    确定 取消
    返回顶部