Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82768

Null check for mData javascript dot notation

$
0
0
Imagine I have a cell that needs to display this :

"aoColumns": [
    { "mData": "metrics.speed" }
]

In my JSON array however some elements have a metrics element while others don't.
Currently, I get either an alert or a JS error when this occurs.

Is there a way to do a null check here ? So when there are no metrics, don't display anything.
If there are metrics, display the speed.

Viewing all articles
Browse latest Browse all 82768

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>