点击一行变色实现了但是根据下标获取一二行不让变色却出问题了

$(".x-table").find("tr").on("click", function() {

    var that = $(this); // 将当前的 this 上下文保存到变量 that 中

    

    var rowIndex = that.attr("tridx"); // 使用 that 来引用原来的 this 上下文

    

    if (rowIndex !== "0" && rowIndex !== "1") {

        _g().addEffect('highlightRow', {

            color: 'red',

            trigger: 'mousedown',

            single: true

        });

    }

});

微信图片_20240428141441.png

FineReport YskqMhxr 发布于 2024-4-28 14:15
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共1回答
最佳回答
0
用户k6280494Lv6资深互助
发布于2024-4-28 14:23

$(".x-table").find("tr").on("click", function() {

    var that = $(this); // 将当前的 this 上下文保存到变量 that 中

    

    var rowIndex = that.attr("tridx"); // 使用 that 来引用原来的 this 上下文

    

    if (rowIndex !== "0" || rowIndex !== "1") {

        _g().addEffect('highlightRow', {

            color: 'red',

            trigger: 'mousedown',

            single: true

        });

    }

});

  • YskqMhxr YskqMhxr(提问者) 不行,还是有问题
    2024-04-28 14:24 
  • 用户k6280494 用户k6280494 回复 YskqMhxr(提问者) JS实现鼠标点击的行变色-https://help.fanruan.com/finereport/doc-view-1201.html
    2024-04-28 14:27 
  • YskqMhxr YskqMhxr(提问者) 点击行变色已经实现了,只是让第一行和第二行不变色实现不了
    2024-04-28 14:34 
  • 2关注人数
  • 114浏览人数
  • 最后回答于:2024-4-28 14:23
    请选择关闭问题的原因
    确定 取消
    返回顶部