How to set default value for null strings

How to set default value for null strings

texqastexqas Posts: 6Questions: 3Answers: 0
edited November 2018 in Free community support

So, I'm using an invisible column as a tool tip in another column. The invisible column has lots of null values and I want to display empty or nothing if the value is null.
Here is what I have.

"render": function (data, type, row, meta) {
id (type=== 'display') {
data = 'blablabla... + row[myInvisiblecolumn] + ...
}
return data;
}

How can I set null to empty? in redner function while concatenating strings?

Thanks.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947
    Answer ✓

    Something like this standard Javascript notation maybe?

    data = 'blablabla... + row[myInvisiblecolumn] === null ? '' : row[myInvisiblecolumn] + ...

    Kevin

  • texqastexqas Posts: 6Questions: 3Answers: 0

    Thanks. You forgot the parenthesis though. :)

This discussion has been closed.