rowId from event driven table

rowId from event driven table

tisawyertisawyer Posts: 12Questions: 4Answers: 1

I'm attempting to add a rowId like so:

var t = $('#mlh').DataTable( {
    rowId: 'rKey'
});

from data generated this way:

        es.addEventListener('lastheard', function (event) {
            var tableData = JSON.parse(event.data).data;
            console.log(tableData.length);
            if (typeof tableData !== "undefined") {
                i=0;
                // Handle one or more rows
                for (i=0; i < tableData.length; i++) {
                    console.log(tableData[i]);
                    t.row.add([
                        tableData[i].rKey,
                        tableData[i].timeStamp,
                        tableData[i].duration,
                        tableData[i].source,
                        tableData[i].user,
                        tableData[i].talkGroup,
                        tableData[i].rssi,
                        tableData[i].cBridge,
                        tableData[i].pktLoss,
                        tableData[i].sourceNo,
                        tableData[i].userNo
                    ]).draw(false);
                }
            }
        });

Tried various variations of above but no luck. TIA for helping.

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.