css - 根据变量突出显示表格行

标签 css twitter-bootstrap drupal drupal-7

我有一个自定义的 drupal 模块,我正在使用主题“表格”创建一个表格。

$header = array();
$header[] = array("data" => "Home Team");
$header[] = array("data" => "Away Team");

$row = array();

foreach ($node as $game) {
  $row = [$hometeam), $awayteam)];
  $rows[] = $row;
}

$table = theme('table', array('header' => $header, 'rows' => $rows));

return $table;

我也在我的站点中使用 Bootstrap 主题。 我想突出显示某些变量满足要求的所有行。例如,突出显示 'Home Team' == 'something' 的所有行。

在我看来,我无法覆盖主题类,还是我遗漏了什么?

最佳答案

如果像在此处创建标题一样构建行,则可以为行或单元格设置属性。 theme_table 中有一个示例将类添加到行的文档。

$rows = array(
  // Simple row
  array(
    'Cell 1', 'Cell 2', 'Cell 3'
  ),
  // Row with attributes on the row and some of its cells.
  array(
    'data' => array(
      'Cell 1', 
      array('data' => 'Cell 2', 'colspan' => 2)
    ), 
    'class' => array('funky') // <-- row class
  )
);

关于css - 根据变量突出显示表格行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29062662/

相关文章:

amazon-web-services - 在 AWS 弹性负载均衡器后面的 Drupal 中启用 https

PHP 将 csv 加载到 sql 表中仅在授予 @localhost 的所有权限时才有效

css - Twitter bootstrap 2 - 自定义按钮样式不起作用

php - 如何获取文本框中的值并将值显示到模式 Bootstrap 中?

css - Bootstrap 药丸和背景

twitter-bootstrap - 水平表格 : Text Input next to label not working

drupal - 如何配对 DDEV 数据库以从 Drupal 7 迁移到 Drupal 8

css - 为什么对齐: center in the parent mess up my position: absolute overlays?

html - 将搜索框从旧网站转移到新网站

javascript - 元素的外观仅在第二次单击时发生变化