Forming a value in a column using another column
Forming a value in a column using another column
ostmal
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
This discussion has been closed.
Answers
What happens? Do you get errors?
Please post a link to your page or a test case showing the issue so we can help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
I will be grateful for your help. link:
http://x2020.ru/5
Thanks. The
return "test" + data.id;
should bereturn "test" + row.id;
. Thedata
parameter is for the data in that column. Therow
parameter is the data for the row.Kevin
Kevin, Thank you very much. It saved me!