如何解决PrimeReact数据表-如何在单元格上显示工具提示或标题?
我正在使用主要反应数据表显示数据表,并且当鼠标悬停在单元格上时,我想显示工具提示或标题,如下图所示。
我遍历了Column组件,但没有找到任何相关的关键字来在单元格上显示工具提示或标题,该单元格用于显示数据表中的列。
代码:
<DataTable
value={this.state.products3}
editMode="row"
dataKey="id"
onRowEditInit={this.onRowEditInit}
onRowEditCancel={this.onRowEditCancel}
>
<Column field="code" header="Code" editor={(props) => this.codeEditor('products3',props)}></Column>
<Column rowEditor headerStyle={{ width: '7rem' }} bodyStyle={{ textAlign: 'center' }} title='Edit'></Column>
</DataTable>
来源:https://primefaces.org/primereact/showcase/#/datatable/edit
您的回答将不胜感激!
解决方法
解决此问题的一种方法是对列使用自定义主体。像这样:
<Column body={() => <Button icon="pi pi-pencil" className="p-button-rounded p-button-text" tooltip="Here's the tooltip!" />} headerStyle={{ width: '7rem' }} bodyStyle={{ textAlign: 'center' }} title="Edit"></Column>
不幸的是,就像您的示例一样,我在设置rowEditor
属性的同时也无法正常工作。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。