I am working on an ASP.NET MVC app, in which in the Front cargo a datatable.net by means of a JSON the problem is that in each row I have to add the icon to edit and delete.
The code I occupy is the following:
HTML and JavaScript
<div class="row">
<div class="col-sm-12">
<table id="clientes" class="table table-hover display">
<thead style="background-color: #337ab7; border-color: #2e6da4; color: #fff;">
<tr>
<td>ClienteId</td>
<td>Razón Social</td>
<td>Número Documento</td>
<td>Dirección</td>
<td>Fijo</td>
<td>Email</td>
<td>Estado</td>
<td><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></td>
<td><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></td>
</tr>
</thead>
<tbody class="celda">
</tbody>
</table>
</div>
</div>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("#clientes").DataTable({
"language": {
"sProcessing": "Procesando...",
"sLengthMenu": "Mostrar _MENU_ registros",
"sZeroRecords": "No se encontraron resultados",
"sEmptyTable": "Ningún dato disponible en esta tabla",
"sInfo": "Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registros",
"sInfoEmpty": "Mostrando registros del 0 al 0 de un total de 0 registros",
"sInfoFiltered": "(filtrado de un total de _MAX_ registros)",
"sInfoPostFix": "",
"sSearch": "Buscar:",
"sUrl": "",
"sInfoThousands": ",",
"sLoadingRecords": "Cargando...",
"oPaginate": {
"sFirst": "Primero",
"sLast": "Último",
"sNext": "Siguiente",
"sPrevious": "Anterior"
},
"oAria": {
"sSortAscending": ": Activar para ordenar la columna de manera ascendente",
"sSortDescending": ": Activar para ordenar la columna de manera descendente"
}
},
ajax: {
"url": "@Url.Action("ListaClientes")",
"dataSrc": ''
},
columns: [
{ "data": "ClienteId" },
{ "data": "RazonSocial" },
{ "data": "NumeroDocumento" },
{ "data": "Direccion" },
{ "data": "Fijo" },
{ "data": "Email" },
{ "data": "Estado" }
]
});
});
The detail is that in each row the edit and delete button must go, is it possible to put HTML code in the JavaScript that I have to populate the datatable?