Topic: Images in react datatables

viperovm free asked 3 years ago


How can I use images in datatables?

Way like this doesn't work:

data: {
    columns: [],
    rows: [
      avatar: <img src{data.personal_info.avatar} alt={data.personal_info.last_name}/>

Krzysztof Wilk staff answered 3 years ago


Everything should work as you did it.

Firstly - add some columns. Without columns, there are no row cells. Secondly - the image should be declared as:

avatar: <img src='' />


avatar: <img src={data.personal_info.avatar} />

In the first example, I used an example image - you can check if it works for you. If something doesn't work - I assume there's a problem with your path property.

Best regards

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.26.1
  • Device: Macbook
  • Browser: Chrome
  • OS: MacOS 11
  • Provided sample code: No
  • Provided link: No