Vinoth S Jr
Vinoth S Jr

Reputation: 3

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>

Upvotes: 0

Views: 1548

Answers (1)

brooooooooook
brooooooooook

Reputation: 11

try adding a body={your desired thing} attribute to the column of your choice

Upvotes: 1

Related Questions