'data is null' error
'data is null' error
mihalisp
Posts: 127Questions: 22Answers: 0
Hi everyone,
I get the field "Hours" from the DB ,but i want to render it so that it gets another value if the value of another column (other_column_id) is '6500'.
But i always get error 'data is null'.
Can anyone help?
Are these 3 conditions (null,'','undefined') always necessary-right to use when to check for null values?
{ "data": "Hours" , "title": "Hours" , "render": function (data, type, row) {
if ((data != null) || (data != '') || (data != 'undefined')){
if ((data.other_column_id != null) || (data.other_column_id != '') || (data.other_column_id != 'undefined')) {
if (data.other_column_id == 6500) { return '6500' ;}
else {return data;} }
else {return data;}
}
else {return null;}
}
}
Thank you.
Answers
You get an error message with 'data is null'? Please post the exact message.
That depends on your data. Do you have null values in your data? And are you trying to not display them if you do?
I'm not clear on what you are trying to do but suggest you use console.log statements in your render function to get an understanding of what its doing so yo can change it to meet your needs. Otherwise we will need a test case with an example of your data to help.
Kevin
Yes,i always get this error
TypeError:data is null
.Yes,i have NULL values which i want to display as NULL or ' '.
Al these columns have some NULL values
I think i have used all the conditions i could have used here.What am i missing?
Try using:
Allan
use default content to handle null values
"data": " ",
"defaultContent": "-----"