Dc datatable without grouping strings

Is it possible to have a DC data table without displaying data in groups? I just want to show all the data for all groups!

My code is as follows:

dc.dataTable(".dc-data-table") .dimension(dateDimension) .group(function (d) { return '' }) .size(10) // (optional) max number of records to be shown, :default = 25 .columns([ function (d) { return getFormattedDate(d.dd); }, function (d) { return d.referredfor; }, function (d) { return numberFormat(d.cost); }, function (d) { return d.gender; } ]) .sortBy(function (d) { return d.dd; }) .order(d3.ascending) .renderlet(function (table) { table.selectAll(".dc-table-group").classed("info", true); }); 

This shows my data table, but with an empty row:

datatable

+6
source share
2 answers

There doesn't seem to be a way to do this at present. Sounds like a reasonable request! You can send a request for improvement or even better, PR.

Here is the relevant code in renderGroups :

https://github.com/dc-js/dc.js/blob/master/src/data-table.js#L121

The embedded data is entered with the key, and then the table rows for each group are added. It would be trivial to disable this, but the problem is that renderRows later selects these "group lines" to add data below them:

https://github.com/dc-js/dc.js/blob/master/src/data-table.js#L156

EDIT: this is an option, .showGroups() , since version 2.0 beta 16

+7
source

The simplest workaround:

You can override the corresponding css class to avoid displaying this line using:

 <style> .dc-table-group{display:none} </style> 

in your html.

+1
source

Source: https://habr.com/ru/post/977881/


All Articles