隐藏dc.dataTable的组行 [英] Hide group rows of dc.dataTable
问题描述
我正在使用JavaScript库 dc.js 动态生成以下内容的表使用 dc.dataTable()
进行记录。数据非常简单,因此我实际上想将其显示为没有任何分组的普通行列表。
I am using the JavaScript library dc.js to dynamically generate a table of records using the dc.dataTable()
. The data is rather simple, so I actually want to show it as a plain list of rows without any grouping.
但是, dc.dataTable( )
需要 .group()
属性。然后,每个这样的组在结果表中的数据行之前都会显示一个额外的行。
However, dc.dataTable()
requires a .group()
attribute. Each such group is then shown with an extra row in the resulting table before its data rows.
var datatable = dc.dataTable("#category-table");
datatable
.dimension(categoryDim)
.group(function(d) {return "Categories";}) //just 1 static group, so it's only 1 unnecessary group label row at least
.columns([
function(d) { return d.category_name; },
function(d) { return d.views;},
]);
如果我跳过 .group()
部分,我得到了
If I skip the .group()
part, I get
必填属性chart.group在图表上缺失
Mandatory attribute chart.group is missing on chart
是否可以隐藏这些组标签行或完全跳过分组?
Is there any way to hide these group label rows or skip the grouping altogether?
推荐答案
隐藏表组行可以使用CSS来实现。这些添加的行具有css类 dc-table-group
,因此可以使用某些自定义css将其隐藏:
Hiding the table group rows is possible using css. These added rows have the css class dc-table-group
and can therefore be hidden using some custom css:
.dc-table-group {
visibility: collapse;
}
这篇关于隐藏dc.dataTable的组行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!