AngularJS-Custom Column in datatable filled with post
AngularJS-Custom Column in datatable filled with post
Hi Guys, how are you?
First time here, i recently started a new project in AngularJS(new for me), and basically im filling the datatable with an post to a wcf.
Until now everything ok, here is my code:
$scope.table = obj.DataTable({
dom: 'Bfrtip',
buttons: [
'excelHtml5',
'pdfHtml5'
],
scrollY: 200,
columns: [
{ mData: "NRO_CODE" },
{ mData: "PERIODO" },
{ mData: "CREACION_INICIO_DEL_CASO" },
{ mData: "HORA_DE_LA_CREACION_DEL_CASO" },
{ mData: "TIPO_DE_CASO" },
{ mData: "EMPRESA_CLIENTE" },
{ mData: "BENEFICIARIO" },
]
});
and at the end of those columns, i want to add a new one, with a button that redirect to another page, with that NRO_CODE on it.
So i need to know how to add that column, and how to get the data from that other column
Thanks
Replies
I think
columns.render
will work for what you want.Kevin
thanks kthorngren, here is my code, i could add a custom column, but i still cannot get the data y want
here is my code:
$scope.table = obj.DataTable({
dom: 'Bfrtip',
buttons: [
'excelHtml5',
'pdfHtml5'
],
scrollY: 200,
columns: [
{ mData: "NRO_CODE" },
{ mData: "PERIODO" },
{ mData: "CREACION_INICIO_DEL_CASO" },
{ mData: "HORA_DE_LA_CREACION_DEL_CASO" },
{ mData: "TIPO_DE_CASO" },
{ mData: "EMPRESA_CLIENTE" },
{ mData: "BENEFICIARIO" },
{
data: "ESTADO",
render: function (data, type, row, meta) {
return '<a href="' + data + '">Download</a>';
}
}
]
});
But im getting the href as undefined
I want that href to be something like:
'<a href=mypage/"' + NRO_CODE + '">Download</a>';
Thanks again
Then you will probably want something like this:
return '<a href="mypage/' + row.NRO_CODE + '">Download</a>';
The
row
parameter contains all the data for that row.Kevin
Thanks a LOT!!