关于冻结行的问题

在以下模板中,我用JS设置了鼠标移过变色变字体的特效,结果不能设置冻结,一设置冻结,特效就没有了,全部变成灰色


WorkBook16.cpt


FineReport nhb2318 发布于 2019-5-19 10:34 (编辑于 2019-5-19 11:00)
1min目标场景问卷 立即参与
回答问题
悬赏:4 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共2回答
最佳回答
3
孤陌Lv6资深互助
发布于2019-5-19 11:09(编辑于 2019-5-19 13:18)

修改一下JS

image.png

var background_color = "rgb(255,0,0)"; //新背景色

var frozen_back_color = new Array();

var back_color = new Array();

var $last_tr;

var i = 0;

// 首行除外

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

//$(".x-table tr")

        if (typeof($last_tr) != "undefined") {

                if (typeof($(this).attr("id")) != "undefined") {

                        if (typeof($("#content-container #frozen-west").attr("id")) != "undefined") {

                                $("#content-container #" + $last_tr.attr("id")).each(function () {

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

                                                $(this).css("background-color", frozen_back_color[$(this).index()]);

                                        });

                                        i = i + 1;

                                });

                                i = 0;

                        } else {

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

                                       $(this).css("background-color", back_color[$(this).index()]);

                                });

                        }

                        frozen_back_color = [];

                        back_color = [];

                }

        }

        if (typeof($(this).attr("id")) != "undefined") {

                if (typeof($("#content-container #frozen-west").attr("id")) != "undefined") {

                        $("#content-container #" + $(this).attr("id")).each(function () {

                                frozen_back_color = new Array();

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

                                        frozen_back_color[$(this).index()] = $(this).css("background-color");

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

                                });

                                i = i + 1;

                        });

                        i = 0;

                } else {

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

                                back_color[$(this).index()] = $(this).css("background-color");


                                

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

                        });

                }

        }

});

//首行除外

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

        if (typeof($(this).attr("id")) != "undefined") {

                $last_tr = $(this);

        }

});


  • nhb2318 nhb2318(提问者) 那如果是前两行呢?
    2019-05-19 13:09 
  • 孤陌 孤陌 回复 nhb2318(提问者) 不管几行 自己弄
    2019-05-19 13:10 
  • 孤陌 孤陌 回复 nhb2318(提问者) $(\'.x-table tr:gt(0)\') .bind(\"mouseenter\", function () 把0修改一下 就是从几行开始
    2019-05-19 13:20 
  • nhb2318 nhb2318(提问者) 回复 孤陌 可以是可以了,但是影响了我的另一个事件 我在有个文本框的初始化事件里加如果代码 //得到“修正分”所在列 var arr = document.getElementById(\"0\").rows.item(0).cells for (var i = 0; i < arr.length; i++) { if (arr[i].innerText == \"修正分\") { break; } } //得到列值 var colstr = arr[i].id.replace(/-*[0-9]/ig, \"\"); //alert(colstr); var shuser = contentPane.curLGP.getCellValue(colstr + 2); var shfs = contentPane.curLGP.getCellValue(colstr + row); //alert(shuser + \" \" + shfs + \" \" + row); //alert(col+\" \"+row) if (shfs < shuser) { this.setEnable(false); //alert(row); } else { this.setEnable(true); } 发现document.getElementById(\"0\"),找不到了,如果设置成不冻结的话就可以用,一设置就不行,怎么解决?
    2019-05-19 23:07 
  • 孤陌 孤陌 回复 nhb2318(提问者) 这个是你 另外的问题 并不是你现在所问的问题
    2019-05-20 08:07 
最佳回答
0
luojian0323Lv7资深互助
发布于2019-5-19 10:37

我所了解的冻结行或者冻结列的确影响JS效果。


  • 3关注人数
  • 358浏览人数
  • 最后回答于:2019-5-19 13:18
    请选择关闭问题的原因
    确定 取消
    返回顶部