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

rayssss

Ray

Posted on June 7, 2024

# 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

💖 💪 🙅 🚩
rayssss
Ray

Posted on June 7, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related