Empty Data handling
Empty Data handling
al_1976
Posts: 9Questions: 3Answers: 0
I have two cells of data. If one is empty, the other one will have a value. Only one will have a value at any time. The psudeo code below is an example of what I would like to do
"columns": [
{ "data": "InformationAssetId" },
{ "data": "CommunicationDate" },
{ "data": "DocumentFullFillmechanism", function (data}{
if (data.length < 1){
{"data": "thisDataInstead"}
}
},
{ "data": "CommunicationSubject" },
{ "data": "CustomerViewable" },
{ "data": "DocumentId" }
{ "data": "AgreementReference"},
]
Many Thanks
This discussion has been closed.
Answers
You could use a "render" function.
https://datatables.net/reference/option/columns.render
Thanks but if I use the render function and the data is empty it throws an error :-(
Apologies to tangerine. The render function does work prefectly for this. My brain obviously doesn't ! Here is my solution in case anyone is in a similar position
{ "data": "AgreementReference", "render" : function (data,type,row,meta){