如何在数据表中合并行距?

问题描述:

我正在尝试将colspanrowspan属性与jQuery Datatables一起使用,其中产品sku可以跨越2行,一周可以跨越2列,从而创建一个看起来像这样的表.

I am trying to use colspan and rowspan attributes with jQuery Datatables where a product sku can span 2 rows and a week can span 2 columns creating a table that looks like this.

这可能吗?

jQuery DataTables在表头中支持ROWSPANCOLSPAN属性,只要每一列至少有一个单元格即可.有关更多详细信息和演示,请参见复杂标题示例.

jQuery DataTables supports ROWSPAN and COLSPAN attributes in the table header as long as there is at least one cell for each column. See Complex header example for more details and demonstration.

jQuery DataTables插件默认不支持表主体中的ROWSPANCOLSPAN属性.

jQuery DataTables plug-in doesn't support ROWSPAN and COLSPAN attributes in the table body by default.

但是对于jQuery数据表,有一个 RowsGroup 插件可以将单元格组合在一起以使其看起来就像使用ROWSPAN属性一样.

However there is a RowsGroup plugin for jQuery DataTables that groups cells together to make them look like as if ROWSPAN attribute is used.

有关代码和演示,请参见此示例.

See this example for code and demonstration.

请参见 jQuery DataTables –表主体中的ROWSPAN TBODY 以获取更多详细信息.

See jQuery DataTables – ROWSPAN in table body TBODY for more details.