Combine columns into one column

Combine columns into one column

davidjmorindavidjmorin Posts: 101Questions: 31Answers: 0

I need to combine columns in my datatable for the email function. I have tried a few different approaches but none seem to work. Any suggestions on how to go about this?

var table = $('#rma_submissions').DataTable( {

        ajax: 'php/table.rma_submissions.php',
        columns: [
            {
                "data": "rma_submissions.location"
            },

            {
                "data": "rma_submissions.rma_number"
            },
            {
                "data": "rma_submissions.paid"
            },
            {
                "data": "rma_submissions.paid_date"
            },

            {
                "data": "rma_submissions.timestamp"
            },

            {
                "data": "rma_submissions.orig_invoice"
            },
            {
                "data": "rma_submissions.all_accessories"
            },
            {
                "data": "rma_submissions.new_submission"
            },
            {
                "data": "rma_submissions.device_man"
            },
            {
                "data": "rma_submissions.vendor"
            },
            {
                "data": "rma_submissions.man_sku"
            },
            {
                "data": "rma_submissions.device_id"
            },
            {
                "data": "rma_reasons.reason_description"
            },
            {
                "data": "rma_submissions.defective_oob"
            },
            {
                "data": "rma_submissions.original_sales_date"
            },

            {
                "data": "rma_submissions.email"
            },

            {
                "data": "rma_submissions.district"
            }
        ],
        select: true,
        "columnDefs": [

             {
    "targets": 15,
    "data": "link",
    "render": function ( data, type, full, meta, row ) {
      return '<a href="mailto:'+data+'?subject=RMA" target="_blank">'+data+'</a>'; // I need to have it read Subject = RMA + device_id
    }
  },
    {
                    "targets":11,
                    "data":"device_id",
                    "render":function(data,type,row){
                    return data + data['district'];
             }
         } ],
        dom: 'BfPrtip',
        "scrollX":        "1200px",
        lengthChange: false,
        scrollX: true,
        deferRender:    true,
    scroller:       true,
        order: [[4,'desc']],
        searchPanes:{
            columns:[8,9,16],
                        cascadePanes: true

        },
        buttons:[
                        { extend: "edit", text: "Update",  editor: editor },
                        { extend: "remove", text: "Delete",  editor: editor },
                        { extend: 'csvHtml5',
            footer: true,
            text:   'Export',
            filename: function(){
                       var d = new Date();
                       month = '' + (d.getMonth() + 1),
                       day = '' + d.getDate(),
                       year = d.getFullYear();
                       var n = d.getTime();
                       var now = new Date();
                       var months = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'];
                       var formattedDate = now.getFullYear() + months[now.getMonth()] + now.getDate();
                       return formattedDate + 'RMA Submissions'}

           },
        ],

    } );

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,172Questions: 26Answers: 4,923
    Answer ✓

    Use the full parameter to access the different objects in the row, for example target="_blank">'+full.rma_submissions.device_id+'</a>.

    Kevin

  • davidjmorindavidjmorin Posts: 101Questions: 31Answers: 0

    Thank you sir! I was using it like full['district']. Thank you again

This discussion has been closed.