Merging two objects of Ajax response into one column

Merging two objects of Ajax response into one column

beginneerbeginneer Posts: 5Questions: 1Answers: 0

Hi,
I need to merge information from two lists received in ajax response and display their data in one column. this link(https://datatables.net/examples/basic_init/hidden_columns.html) explains how to hide columns. But I need to get data of hidden column and append it to another column, How do I do that. below is my code. column 3 is hidden but column 4 does not contain data from list1.


$j('#mydataTable').DataTable({ "processing": true, "serverSide": true, "ajax": "datasource.json", "columns": [ {"data": "name"}, {"data": "office"}, {"data": "phone"}, {"data": "list1"}, {"data": "list2"} ], columnDefs: [ { targets: [ 3,4], "orderable": false, render: function ( data, type, row ) { console.log("data : "+data); return data; } }, { targets: [3], "orderable": false, "visible": false, "searchable": false } ] });

Replies

  • beginneerbeginneer Posts: 5Questions: 1Answers: 0

    Thanks I found it, Its easy,
    {
    targets: [ 4],
    "orderable": false,
    render: function ( data, type, row ) {
    return data+row.list1;
    }
    },

This discussion has been closed.