Forming a value in a column using another column

Forming a value in a column using another column

ostmalostmal Posts: 102Questions: 33Answers: 0

I would like to apply the value of another column to generate the value of the current column. Just like here:

https://datatables.net/manual/data/renderers

{
    data: 'creator',
    render: function ( data, type, row ) {
        return data.firstName +' '+ data.lastName;
    }
}

My code is:

var table = $('#id_mkd').DataTable( {
    dom: 'Bfrtip',
    
    
    ajax: {
        url: '/abc/dt/my/mkd/mkd.php',
        type: 'POST',
        data: {
            okr : okrug
        }
    },
    columns: [
        {
            data: "id"
        },
        {
            data: "ul",
            render: function ( data, type, row ) {
                return "test" + data.id;
            }
        }
    ],
    select: true,
    lengthChange: false,
    buttons: [
        { extend: 'create', editor: editor },
        { extend: 'edit',   editor: editor },
        { extend: 'remove', editor: editor }
    ]
} );
} );

}(jQuery));

It doesn't work for some reason!!

I'm sorry, I've only just started and a lot of things aren't working out.

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.