使用 JavaScript 更改 Oracle APEX 交互式网格上的背景颜色行

问题描述 投票:0回答:1

我有一个交互式网格,其中一列 ID 设置为

DaysIn
,并且我已将静态 ID 设置为
di

我想根据

DaysIn
中的数字值更改背景行颜色。

我已将以下代码添加到刷新后的动态操作中 - 但它不起作用。

$('td[headers="di"]').each(function() {
  if ($(this).text() < '30') {
    $(this).closest('tr').find('td').css({
      "background-color": "beige"
    });
  }

  if ($(this).text() >= '30' && $(this).text() < '60') {
    $(this).closest('tr').find('td').css({
      "background-color": "lightgreen"
    });
  }

  if ($(this).text() >= '60' && $(this).text() < '65') {
    $(this).closest('tr').find('td').css({
      "background-color": "lightblue"
    });
  }

  if ($(this).text() >= '65') {
    $(this).closest('tr').find('td').css({
      "background-color": "pink"
    });
  }
});

感谢您的帮助。

javascript oracle oracle-apex apex
1个回答
-1
投票

是的,我知道 - 您指定要使用 JavaScript。

但是,如果您已经使用 Oracle Apex,您是否考虑过使用内置功能并使用 Interactive Grid 的“操作”突出显示行?

© www.soinside.com 2019 - 2024. All rights reserved.