Getting values from hidden columns

Getting values from hidden columns

rrzavaletarrzavaleta Posts: 78Questions: 52Answers: 2

How Can I get the values from hidden columns?

My code is:

"columns": [
{
"data": null,
'render': function (data, type, full, meta){
return '<input class="check-row" type="checkbox">';
}
},
{"data": "column1", "visible":false},
{"data": "column2", "visible":false},
{"data": "column3", "visible":false},
{"data": "column4", "visible":false},
{"data": "column5", "visible":false},
{"data": "column6"},
]

I have a json with the rows selected, but I can´t get the values of the hidden columns, How can I do it?

This is my code for the rows selected:

$.each(rows, function(i, obj) {

var column6=$(obj.row).closest('tr').children('td').eq(1).text();

});

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    Answer ✓

    Use the row().data() method.

    Allan

  • rrzavaletarrzavaleta Posts: 78Questions: 52Answers: 2

    thx allan, a got .

    var oTable= $('#example').DataTable( {...
    { data: "position", "visible":false},
    ..} );

    $('#example').on('dblclick', 'td', function (e) {
    var data1 = oTable.row( $(this).parents('tr') ).data()["position"];
    alert(data1);
    } );

    k

This discussion has been closed.