制表符 - 将子表添加到多表头表的表头中

问题描述 投票:0回答:1

我有一个制表表,其中有多个带有组的标题,即标题和副标题。我想向此演示中列出的标题“子标题”添加一个子表。

       <https://jsfiddle.net/4gatx38n/1/>

请告诉我如何添加?

nested tabulator nested-table
1个回答
0
投票

如果它们与列无关,那么您可以将它们粘贴在表格上方的 div 中。

如果您正在谈论分组列,那么制表符通过在列定义中使用嵌套对象来内置该功能

var table = new Tabulator("#example-table", {
    columnHeaderVertAlign:"bottom", //align header contents to bottom of cell
    columns:[
        {title:"Name", field:"name", width:160},
        {//create column group
            title:"Work Info",
            columns:[
            {title:"Progress", field:"progress", hozAlign:"right", sorter:"number", width:100},
            {title:"Rating", field:"rating", hozAlign:"center", width:80},
            {title:"Driver", field:"car", hozAlign:"center", width:80},
            ],
        },
        {//create column group
            title:"Personal Info",
            columns:[
            {title:"Gender", field:"gender", width:90},
            {title:"Favourite Color", field:"col", width:140},
            {title:"Date Of Birth", field:"dob", hozAlign:"center", sorter:"date", width:130},
            ],
        },
    ],
});

有关完整详细信息,请查看列分组文档

© www.soinside.com 2019 - 2024. All rights reserved.