We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
先使用自定义层级layoutHierarchy插入了自定义的节点,然后针对自定义的节点使用layoutCellMeta重置渲染数据逻辑,插入的节点渲染时异常,但是在下载时不显示数据,(之前1.x版本是支持的)
打开官网链接 https://s2.antv.antgroup.com/examples/react-component/export#export 填充如下代码
// organize-imports-ignore import React from 'react'; import { S2DataConfig, Node, generateId, EXTRA_FIELD, VALUE_FIELD } from '@antv/s2'; import { SheetComponent, SheetComponentOptions } from '@antv/s2-react'; import '@antv/s2-react/dist/style.min.css'; fetch( 'https://gw.alipayobjects.com/os/bmw-prod/cd9814d0-6dfa-42a6-8455-5a6bd0ff93ca.json', ) .then((res) => res.json()) .then((res) => { const s2Options: SheetComponentOptions = { width: 600, height: 480, interaction: { copy: { enable: true }, }, layoutHierarchy: (s2, node) => { // layoutHierarchy 用于手动控制行列结构的增加、删除的特殊场景。 // 以 「宁波市」为例,删除其节点,增加宁波A和宁波B节点。 const { field, value } = node; if (field === 'city' && value === '宁波市') { const preValue = '宁波A'; const nextValue = '宁波B'; const parentNode = node.parent; const preUniqueId = generateId(parentNode.id, preValue); const nextUniqueId = generateId(parentNode.id, nextValue); const preNode = new Node({ ...node, id: preUniqueId, value: preValue, query: { ...parentNode?.query, [node.field]: preValue }, }); const nextNode = new Node({ ...node, id: nextUniqueId, value: nextValue, query: { ...parentNode?.query, [node.field]: nextValue }, }); return { push: [nextNode], unshift: [preNode], delete: true, }; } return null; }, layoutCellMeta: (viewMeta) => { // 动态改变指定单元格数据, 修订某个或者某些格子的值 // 下面以更改「浙江省-宁波市-家具-桌子」的单元格数据为例 const { rowIndex, colIndex } = viewMeta; if (rowIndex === 2 || rowIndex === 3) { return { ...viewMeta, data: { province: '浙江省', city: '宁波市', type: '家具', sub_type: '桌子', number: 99999, [EXTRA_FIELD]: 'number', [VALUE_FIELD]: 99999, }, fieldValue: 99999, }; } return viewMeta; }, }; const s2DataConfig: S2DataConfig = { fields: { rows: ['province', 'city'], columns: ['type', 'sub_type'], values: ['number'], }, meta: res.meta, data: res.data, }; reactDOMClient.createRoot(document.getElementById('container')).render( <SheetComponent dataCfg={s2DataConfig} options={s2Options} header={{ export: { open: true, }, }} adaptive={false} />, ); });
https://s2.antv.antgroup.com/examples/react-component/export#export
自定义行能正常下载数据
渲染正常 但是下载时缺失数据
The text was updated successfully, but these errors were encountered:
No branches or pull requests
🏷 Version
Sheet Type
🖋 Description
先使用自定义层级layoutHierarchy插入了自定义的节点,然后针对自定义的节点使用layoutCellMeta重置渲染数据逻辑,插入的节点渲染时异常,但是在下载时不显示数据,(之前1.x版本是支持的)
⌨️ Code Snapshots
打开官网链接 https://s2.antv.antgroup.com/examples/react-component/export#export
填充如下代码
🔗 Reproduce Link
https://s2.antv.antgroup.com/examples/react-component/export#export
🤔 Steps to Reproduce
😊 Expected Behavior
自定义行能正常下载数据
😅 Current Behavior
渲染正常 但是下载时缺失数据
💻 System information
The text was updated successfully, but these errors were encountered: