Skip to content

Commit

Permalink
docs: 增加明细表 rowSpan 示例 demo
Browse files Browse the repository at this point in the history
  • Loading branch information
wywppkd committed May 11, 2023
1 parent 20b9c95 commit 4ae5765
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
8 changes: 8 additions & 0 deletions s2-site/examples/basic/table/demo/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
"en": "Column Group"
},
"screenshot": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*DgnhTYveL1AAAAAAAAAAAAAADmJ7AQ/original"
},
{
"filename": "table-column-group-customize-cell.ts",
"title": {
"zh": "列分组自定义合并单元格",
"en": "Column Group Customize The Cell"
},
"screenshot": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*DgnhTYveL1AAAAAAAAAAAAAADmJ7AQ/original"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { TableSheet } from '@antv/s2';

fetch('https://assets.antv.antgroup.com/s2/basic-table-mode.json')
.then((res) => res.json())
.then((data) => {
const container = document.getElementById('container');
const s2DataConfig = {
fields: {
columns: [
{
key: 'area',
children: [
{
rowSpan: 2,
key: 'province',
},
{
rowSpan: 2,
key: 'city',
},
],
},
'type',
{
key: 'money',
rowSpan: 2,
children: [
{
key: 'price',
},
],
},
],
},
meta: [
{
field: 'province',
name: '省份',
},
{
field: 'city',
name: '城市',
},
{
field: 'type',
name: '商品类别',
},
{
field: 'price',
name: '价格',
},
{
field: 'cost',
name: '成本',
},
{
field: 'area',
name: '位置',
},
{
field: 'money',
name: '金额',
},
],
data,
};

const s2Options = {
width: 600,
height: 480,
showSeriesNumber: true,
};
const s2 = new TableSheet(container, s2DataConfig, s2Options);

s2.render();
});

0 comments on commit 4ae5765

Please sign in to comment.