Datatables columns

0

As you can concatenate two records in a single column in a datatable, so far I only do it with one record, but I need to do the two, this in order to optimize the space horizontally of the datatable.

I'm doing something like this:

columns: [
                    { 'data': 'C019fechaRegistro' },
                    { 'data': 'C019hora' },
                    { 'data': 'C019alertaIn' },
                    { 'data': 'C019alertaSup' },
                    { 'data': 'C019accionIn' },
                    { 'data': 'C019accionSup' }]

but I need together the registration date and the time in a single column. How can I do it?

    
asked by Luis Miguel Viana 03.05.2018 в 00:13
source

1 answer

0

You can do it in the following way, concatenating the fields of your Datatable()

columns: [
            { 'data': 'C019fechaRegistro'+' '+'C019hora'},
            { 'data': 'C019alertaIn' },
            { 'data': 'C019alertaSup' },
            { 'data': 'C019accionIn' },
            { 'data': 'C019accionSup' }]

You can also do it with a render:

    columns: [
            {render: function ( data, type, row ) {
                    return data.C019fechaRegistro+' '+data.C019hora;
                    //return row[0]+' '+row[1];
            } },
            { 'data': 'C019alertaIn' },
            { 'data': 'C019alertaSup' },
            { 'data': 'C019accionIn' },
            { 'data': 'C019accionSup' }]
    
answered by 03.05.2018 / 00:21
source