I do: I get a few records in a DataSet from SQL Server, return to fromEnd sereializados JSON when I receive my reply ajax what convierto format json, now I want to paint them in a DataTable paginated as follows way: if I get 4 registration will be a record for each page, then it will be 4 pages, one record per page, I can not configure the datatable so that it is that way .... I am a newbie in web development, I need your help.
my table is as follows:
<table id="tablaReportes" class="table table-hover">
<thead id="tbl">
<tr>
<th>Fecha y Hora</th>
<th>Limites alerta (inf/sup)</th>
<th>Limites accion (inf/sup)</th>
<th>Usuario</th>
<th>Ver</th>
</tr>
</thead>
</table>
When my document is ready I do the following:
$('#tablaReportes').DataTable({
scrollY: 400,
scrollCollapse: true,
paging: true,
searching: false,
ordering: false,
info: false,
});
and the way I walk the json object to add content to the table is as follows:
$.each(json.Table, function (index, item) {
var aLimites = [{ alertaIn: item.C019alertaIn },
{ alertaSup: item.C019alertaSup },
{ accionIn: item.C019accionIn },
{ accionSup: item.C019accionSup },
{ obsGrafica: item.C019obsGrafica }];
$("#tablaReportes").append("<tr><td>" + item.C019fechaRegistro + " ; " + item.C019hora+ "</td>"
+ "<td>[" + item.C019alertaIn + "][" + item.C019alertaSup + "]</td>"
+ "<td>[" + item.C019accionIn + "][" + item.C019accionSup + "]</td>"
+ "<td>" + item.C019NomUsuario + "</td>"
+ "<td><button type='button' class='btn btn-warning' onclick='grafica(" + item.C019SeriesData + ", " + JSON.stringify(aLimites) + "," + item.C019codDetalle + ")'><i class='fa fa-line-chart'></i></button> "
+ "<button type='button' class='btn btn-primary' onclick='verObservacion(" + item.C019codDetalle + ")'><i class='fa fa-comments-o'></i></button></td></tr>");
});
I would appreciate it enough for your help!