How to display null values in MDBTable

web
mobile

Topic: How to display null values in MDBTable

karthiksagar9 asked 2 months ago

Expected behavior Display null values from api

Actual behaviorenter image description here

Resources (screenshots, code snippets etc.)


Jakub Chmura staff premium answered 2 months ago

Hi @karthiksagar9,

Can you explain to me what do you mean about this? You mean to show null as a string "null" or put there some kind of placeholder?

Please tell me more about this because I don't know what you want to achieve.

Best, Kuba


karthiksagar9 commented 2 months ago

Hi , Sample response from api { "name":"test", "email":null,

}

In the table i want to display either "null" or "None" in the place of email.


Jakub Chmura staff premium answered 2 months ago

Hi, @karthiksagar9,

I don't know your API structure, but you need to write your own method to replace null values to string "null".

Something like that:

function (key, value) {
    return (value === null) ? "null" : value
}

If there is anything else I could do for you do not hesitate to ask me. I'll be happy to help you.

Best, Kuba


Please insert min. 20 characters.
Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: React
  • MDB Version: 4.25.1
  • Device: MAC
  • Browser: Chrome
  • OS: MAC OS
  • Provided sample code: No
  • Provided link: No