How do I get the value of a hidden column?

How do I get the value of a hidden column?

patreeeeekpatreeeeek Posts: 14Questions: 7Answers: 0
edited July 2018 in Free community support

This is how I generate my datatable:

$(document).ready(function () {        
            $('#datatables').DataTable({
                "dom": '<"toolbar">frtip',
                "responsive": true,
                "scrollY": "550px",
                "scrollCollapse": true,
                "ajax": "smsMessages.json",
                "aoColumns": [
                    {"mData": "sender"},
                    {"mData": "content"},
                    {"mData": "receiveTime"},
                    {"mData": "messageId"},
                    {"mData": "messageId",
                        "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
                            $(nTd).html("<i class='ti-pencil-alt btn btn-simple btn-edit btn-icon' data-target='#replyModal' data-toggle='modal' data-mode='edit'></i>\n\
                         ");
                        }
                    }
                ],
                language: {
                    "search": "_INPUT_",
                    searchPlaceholder: "Search records"
                }
                
            });

This is how I access the content

$('#datatables tbody').on('click', '.btn-edit', function () {
                var dt = $('#datatables').DataTable();
                var data = dt.cells($(this).closest('td').siblings().eq(0)).data();
                var data2 = dt.cells($(this).closest('td').siblings().eq(1)).data();
                var data3 = dt.cells($(this).closest('td').siblings().eq(2)).data();
                var data4 = dt.cells($(this).closest('td').siblings().eq(3)).data();
                var sender = data[0];
                var message = data2[0];
                var dateR = data3[0];
                var messageId = data4[0];
                var dateRe = new Date(dateR);
                alert(messageId);
                dateReceived = moment(dateRe).format("MM/DD/YYYY hh:MM A");
     
                $('#sender').val(sender).change();
                $('#message').val(message).change();
                $('#dateReceived').val(dateReceived).change();
            });

I've tried to do this
{"mData": "messageId","visible":false},
but once I do, it will return undefined

if you guys have any other suggestions on how I can do this it would be of great help

Answers

This discussion has been closed.