Skip to content
New issue

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

table components.header.cell 有导出表示唯一列的标志吗? #991

Open
vaynevayne opened this issue May 8, 2023 · 3 comments
Open

Comments

@vaynevayne
Copy link

我使用react-sortable-hoc 制作可拖拽排序列, 但是发现cell

  components={{
            header: {
              row: DraggableContainer,
              cell: Cell,
            },
          }}

const Th = SortableElement((props) => <th {...props} />)

const Cell = ({ className, style, ...restProps }) => {
  console.log('restProps', restProps) // 需要一个唯一的值 给index

  return <Th index={JSON.stringify(restProps.children)} {...restProps} />
}

image

@Ylg12345
Copy link
Contributor

Ylg12345 commented May 9, 2023

这个pr我在ant-design也看到了,如果他们官方确认了这个issue,我可以加个列的index

@vaynevayne
Copy link
Author

好的, 多谢,
不过还是不太懂这个Cell, 话说自定义渲染, 我需要自己渲染title 才对吧 , 不知道为啥title自己渲染了,
而且cell 给出来的 title属性是空的 很懵逼,不知道怎么用

@Ylg12345
Copy link
Contributor

Ylg12345 commented May 9, 2023

好的, 多谢, 不过还是不太懂这个Cell, 话说自定义渲染, 我需要自己渲染title 才对吧 , 不知道为啥title自己渲染了, 而且cell 给出来的 title属性是空的 很懵逼,不知道怎么用

我理解的是,不是用title渲染的,使用children,如果想自己定义title内容渲染,可以用onHeaderCell函数传title,
然后这样用,<th {...restProps} >{title}</th>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants