[英]How to add image in primereact datable column
嗨,我是 Reactjs 和 Primereact https://www.primefaces.org/primereact/#/datatable 的新手。 为了绑定表中的数据,我选择了prime react 数据表。 现在我不知道如何在数据表中添加图像标签。
我尝试在列内使用一些图像标签,但这不起作用,它只是扩展了列但我的图像没有显示。
在这里我粘贴了我的代码
<DataTable ref={(el) => this.dt = el} value={this.state.cars} paginator={true} rows={10} header={header}
globalFilter={this.state.globalFilter} emptyMessage="No records found" sortMode="multiple">
<Column field="vin" header="Vin" filter={true} sortable={true} editor={this.vinEditor} editorValidator={this.requiredValidator} style={{height: '3.5em'}}/>
<Column field="year" header="Year" filter={true} sortable={true} editor={this.yearEditor} style={{height: '3.5em'}}/>
<Column field="brand" header="Brand" filter={true} filterElement={brandFilter} sortable={true} editor={this.brandEditor} style={{height: '3.5em'}}/>
<Column field="color" header="Color" filter={true} filterElement={colorFilter} sortable={true} editor={this.colorEditor} style={{height: '3.5em'}} />
<img src="http://www.macmillandictionaryblog.com/wp-content/uploads/2011/09/wifi.jpg" alt="Smiley face" width="42" height="42"/>
<input type="image" src="http://www.macmillandictionaryblog.com/wp-content/uploads/2011/09/wifi.jpg" alt="Submit" width="48" height="48"/>
</DataTable>
尝试向您选择的列添加body={your desired thing}
属性
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.