Quantcast
Channel: DataTables 1.9 — DataTables forums
Viewing all articles
Browse latest Browse all 1816

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 1816

Trending Articles