反应数据表网格中的样式单元格
我遇到了一个非常好的包,名为 react-datasheet-grid。 我想根据特定单元格的值对其进行着色。 当我构建表格(数据表)时,我按照文档所述使用列数组来完成。 当我想要设计它时,只有整个表格的样式示例。 我想设置特定单元格的样式,但我不知道如何实现它。
I came across a very nice package called react-datasheet-grid.
I want to color a specific cell depending on it's value.
When I build the table (data-sheet) I do it with an array of columns as the doc says.
When I want to style it there are examples only for styles the whole table.
I want to style a specific cell but I don't know how to reach it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在单元对象内分配类名。请参阅下面的[希望如此?] 完整的示例:
在此示例中,您需要将声明的类添加到 CSS 样式表中。这是我的来源,以防您有后续问题 - https://github.com/romanstan1 /react-datasheet-header。
请注意,如果您计划对示例进行样板化,则需要通过 props 传递
tableContent
。You can assign classNames within the cell object. Please see the [hopefully?] complete example below:
In this example, you would need to add the declared class to your CSS styling sheet. Here is my source in case you have follow-up questions - https://github.com/romanstan1/react-datasheet-header.
Note that if you plan to boilerplate the example, you will need to pass
tableContent
in via props.您可以使用 cellClassName 属性来实现它。
https://react-datasheet-grid.netlify.app /docs/api-reference/columns/#cellclassname
You can use cellClassName prop to achieve it.
https://react-datasheet-grid.netlify.app/docs/api-reference/columns/#cellclassname