在 @antv/s2 中配置表格时,如果data数据里有嵌套对象(如 info.name), 那想渲染name这列数据, 该怎么处理? #3231
Unanswered
xincheng123
asked this question in
Q&A
Replies: 1 comment
-
|
@xincheng123 您好!以下是关于您问题的自动回复: 您好!针对您关于 @antv/s2 数据配置嵌套对象字段(如 info.name)的讨论,这里为您详细解答如何处理并正确渲染嵌套数据结构的列。 问题分析您的数据结构如下: data: [
{
info: {
name: '哈哈哈',
sex: '男'
}
}
]而您希望在表头配置中,能够直接渲染 info.name 和 info.sex 两个字段。 解决方案1. S2 不支持直接通过
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
例如:
export const s2DataConfig = {
describe: '明细表',
fields: {
// 列头字段
columns: [
{
field: 'info',
title: '基本信息',
children: [
{ field: 'name', title: '名称' },
{ field: 'sex', title: '性别' },
],
},
],
},
data: [
{
info: {
name: '哈哈哈',
sex: '男'
}
}
]
}
这种data是嵌套数据结构的, 该如何配置fields?
Beta Was this translation helpful? Give feedback.
All reactions