简体   繁体   中英

How to add image in primereact datable column

Hi I'm new to Reactjs and primereact https://www.primefaces.org/primereact/#/datatable . to bind the datas in table I have choosen prime react datatable. Now I dont know how to add image tag in datatable.

I have tried with some image tag inside the column but this not working, it just extend the column but my image is not showing.

here i have pasted my code

<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}属性

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM