question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] data-table: ability to group headers/columns

See original GitHub issue

Problem to solve

It is currently not possible to group table headers / columns so that related headers can have a common title above them.

There are various use cases across different industries for being able to create column groups, especially when doing multi-dimension comparisons (I can provide real-world examples if needed).

Proposed solution

From a props perspective, I think one could augment the current :headers prop to accept nested column definitions. Something along these lines:

[
{ text: 'Total', value: 'yearlyTotal', align: 'left' },
{
 text: 'Q1 2019',
 align: 'center',
 headers: [
    { text: 'Travel', value: 'travelQ1' },
    { text: 'Food', value: 'foodQ1' },
    { text: 'Equipment', value: 'equipmentQ1' }
  ]
},
{
{
 text: 'Q2 2019',
 align: 'center',
 headers: [
    { text: 'Travel', value: 'travelQ2' },
    { text: 'Food', value: 'foodQ2' },
    { text: 'Equipment', value: 'equipmentQ2' }
  ]
}
]

Column nesting / grouping to continue recursively (meaning the developer could create as much grouping and sub-groupings as they need). Column groups would not be sortable nor filtrable, only individual columns.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:10
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
nikoalirocommented, Jan 22, 2020

Sorry for the late response. I can see my custom header placed under the default one, it is not replacing the default header with the custom one. This is my code:

<v-data-table ...>
  <template v-slot:header="props" >
    <tr><th>...</th></tr>
    <tr><th>...</th></tr>
  </template>
</v-data-table>

Using this info, it turns out you can simply implement your own categories line above the default headers if you just add <thead> in the slot template. Leaving out the <thead>, as you said, puts it underneath.

<v-data-table ...>
  <template v-slot:header="props" >
    <thead>
      <tr>
        <th colspan="2">Category 1</th>
        <th colspan="3">Category 2</th>
      </tr>
    </thead>
  </template>
</v-data-table>
2reactions
nekosaurcommented, Aug 28, 2019

yes, you have to manually set hide-default-header

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rowgroup with dynamic source and making group header a link
Hello, I am trying to figure out if it is possible to make a rowgroup header a link when the rowgroups are dynamic....
Read more >
Configuring Columns - DataTable - Documentation - Webix
Webix Documentation: Learn how you can configure columns of the DataTable widget: add or delete columns dynamically, group columns, use styles, etc.
Read more >
Introduction to data.table
table syntax, its general form, how to subset rows, select and compute on columns, and perform aggregations by group. Familiarity with data.
Read more >
lightning-datatable - documentation - Salesforce Developers
If hideDefaultActions is set to true on a column that has custom header actions, the "Clip text" and "Wrap text" actions are removed...
Read more >
Append queries - Power Query | Microsoft Learn
If one of the appended tables doesn't have a column header from other tables, the resulting table shows null values in the respective...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found