合併儲存格
合併儲存格的功能,可設定 表頭儲存格合併、內容儲存格合併、Footer儲存格合併
如果要使用表頭儲存格合併,需要在 title
參數中的欄位 colSpan
設定,例如 colSpan: 3
如果要使用內 容儲存格合併,需要在 data.field
參數中的欄位 colSpan
設定,例如 colSpan: 4
import AcroolTable from '@acrool/react-table';
const Colspan = () => {
return <AcroolTable
title={{
avatar: {text: '#', col: 50, titleAlign: 'center', dataAlign: 'center', colSpan: 3},
name: {text: 'Name', col: 'auto'},
amount: {text: 'Amount', col: '80px', titleAlign: 'right', dataAlign: 'right'},
role: {text: 'Role', col: '120px'},
createdAt:{text: 'Crated', col: '110px'},
joined: {text: 'Joined', col: '80px'},
}}
data={data.slice(0, 6).map((row, index) => {
return {
id: row.id,
field: {
avatar: <Avatar src={row.avatar}/>,
name: row.name,
role: row.role,
createdAt: dayjs(row.createdAt).format('MM/DD'),
joined: row.isJoined ? 'Y':'N',
amount: {
colSpan: index === 0 ? 4: 1,
dataAlign: index === 0 ? 'center': 'right',
value: index === 0 ? 'ColSpan 4': `$ ${formatCurrency(row.amount)}`
},
},
};
})}
/>
}
Colspan 3 | Role | Crated | Joined | ||
---|---|---|---|---|---|
Jack Wu | ColSpan 4 | ||||
Imagine Chiu | $ 99 | Guest | 12/15 | Y | |
Jason Dinwiddie | $ 880 | Manage | 12/12 | N | |
Gloria Lu | $ 12,300 | Guest | 12/11 | Y | |
Adam Bolton | $ 2,500 | Guest | 12/12 | N | |
Stanley McQueen | $ 200 | Guest | 12/12 | N |
Loading...
Show 1 - 0 itemTotal 0 item / 1 Page