How to set default value for null strings
How to set default value for null strings
![texqas](https://secure.gravatar.com/avatar/19ea3970b630f9a28c66d18e01c0e4e8/?default=https%3A%2F%2Fvanillicon.com%2F19ea3970b630f9a28c66d18e01c0e4e8_200.png&rating=g&size=120)
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
This discussion has been closed.
Answers
Something like this standard Javascript notation maybe?
data = 'blablabla... + row[myInvisiblecolumn] === null ? '' : row[myInvisiblecolumn] + ...
Kevin
Thanks. You forgot the parenthesis though.![:) :)](https://datatables.net/forums/resources/emoji/smile.png)