How to add "Not set" if value in row is empty

How to add "Not set" if value in row is empty

inajafinajaf Posts: 13Questions: 8Answers: 0
edited October 2021 in Responsive


Hi guys, I can't add a default value for empty data, like "Not set" if empty value in the row

This question has an accepted answers - jump to answer

Answers

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @inajaf ,

    Have a look at the columns.render documentation, I think it should provide what you are looking for.

    If you can't get it to work, could you please link to a test case. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Thanks,
    Sandy

  • inajafinajaf Posts: 13Questions: 8Answers: 0
    edited October 2021

    Hi @sandy,
    I found the parameter for the default value https://datatables.net/reference/option/columns.defaultContent, but I have some issues for applying it to my current code, I need to add some fields in options that could be empty or null and set the default value: "Not set".
    Here is a link to my current js file live.datatables.net/zecewuhi/1/

    I need for Example "Additional phone number, Trailer Number" that could be null or empty and set them to "Not Set".

  • colincolin Posts: 15,177Questions: 1Answers: 2,590
    Answer ✓

    As Sandy said, use columns.render, see "Ashton Cox" in this example,

    Colin

Sign In or Register to comment.