1

在为表格行中的菜单选项选择齿轮图标时,我需要将背景创建为黄色,我尝试了以下代码来突出显示表格行,

var view = Core.view.Menu.create({
    model: model,
    menuContext: { ibmm: ibmm },
    anchor: this.$(),
    highlight: this.$().parents('tr:first').css('background-color','yellow')
});
view.show();

从带有齿轮图标的表格行(隐藏)中选择菜单时,背景颜色很好。

[![在此处输入图像描述][1]][1]

对应的html文件如下

<tr id="ember23242" class="ember-view content-row body-row-view container-view" tabindex="0" aria-label="">

但是当我移动到下一个表格行(非隐藏)时,过去的表格行颜色仍然是黄色,没有消失。

[![在此处输入图像描述][2]][2]

当我单击行时,我正在使用下面的 css 代码来创建突出显示

table.content-table.highlighted tr.content-row:focus {
  background: #FFFF99 none 0 0 repeat;
}

任何人都可以建议我为此编写代码。我正在使用 Ember 1.4.0。

4

2 回答 2

0

您可以在 jquery 下面尝试重置您的背景颜色,其中事件将发生在 focusout 上。

$(function(){
  $("table.content-table.highlighted tr.content-row").on("focusout", function(){
        $(this).css('background','#FFFF00 none 0 0 repeat'); // change color code as per your need
  });
});
于 2018-09-05T13:44:40.623 回答
0

:first检查和之间的区别:first-child

var view = Core.view.Menu.create({
    model: model,
    menuContext: { ibmm: ibmm },
    anchor: this.$(),
    highlight: this.$().parents('tr:first-child').css('background-color','yellow')
});
view.show();
于 2018-09-05T12:36:13.657 回答