DEV Community

Ray
Ray

Posted on

# VTable usage issue: How to set multi-level table headers

Question title

How to set up multi-level headers

Problem description

How to configure headers to achieve multi-level header grouping effect

Solution

In the columnconfiguration in VTable, it supports specifying the subordinate table header of the column through the columnsconfiguration, and this rule can be used for multi-level nesting

Code example

const columns = [
  {
    field: 'id',
    title: 'ID',
    width: 100
  },
  {
    title: 'Name',
    columns: [
      {
        field: 'name1',
        title: 'name1',
        width: 100
      },
      {
        title: 'name-level-2',
        width: 150,
        columns: [
          {
            field: 'name2',
            title: 'name2',
            width: 100
          },
          {
            title: 'name3',
            field: 'name3',
            width: 150
          }
        ]
      }
    ]
  }
];

const option = {
  records,
  columns,
  // ......
};
Enter fullscreen mode Exit fullscreen mode

Results show

Image description

Complete example: https://www.visactor.io/vtable/demo/basic-functionality/list-table-header-group

Related Documents

Related api: https://www.visactor.io/vtable/option/ListTable-columns-text#columns

github:https://github.com/VisActor/VTable

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay