How to make Datatable Jquery dynamically
How to make Datatable Jquery dynamically
wduvan
Posts: 1Questions: 1Answers: 0
I need to make a table dynamically with DataTable, the table must beServer-side processing type and in the same request (Ajax) and answer the columns are made and obviously the results.
DatosColumna=""//Json with Response of ajax
$('#table_query_info').dataTable({
columnDefs: DatosColumna,//Here its the headers
destroy: true,
processing: true,
serverSide: true,
ajax: {
url: myBaseUrl + "consults/find_docs",
type: "post",
data: function (d) {
d.datos = make_info()//Send Json with info
},
statusCode: {
200: function (resp) {
alert("OK");//That Good
}
}
}
});
I tried with this code but it has not worked
My codebehind its in php but return this info in json
{
"draw": 0,
"recordsTotal": 11700,
"recordsFiltered": 11700,
"data": [
[
"Folder Inges",
"JURIDICA",
"7",
0,
"JURIDICA",
"1",
"Iniciado",
"User My App",
"2016-06-30 00:00:00",
null,
"JURIDICA",
null,
"LIGIA JACQUELINE SOTELO- PEDRO MALAVER",
"<a href=\"#!\" class=\"btn-floating waves-effect waves-light blue tooltipped link_traza\" data-position=\"top\" data-delay=\"50\" data-tooltip=\"Trazabilidad\" data-paquete_id=\"58\"><i class=\"material-icons\">timeline</i></a><a href=\"#!\" class=\"btn-floating waves-effect waves-light blue tooltipped btn_verdocs\" data-position=\"top\" data-delay=\"50\" data-tooltip=\"Ver documentos\" data-paquete_id=\"58\"><i class=\"material-icons\">library_books</i></a>"
],
[
"Folder Inges",
"JURIDICA",
"8",
0,
"JURIDICA",
"1",
"Iniciado",
"Other User My BD",
"2016-06-30 00:00:00",
null,
"JURIDICA",
null,
"SUPERINTENDENCIA FINANCIERA CARTA RECIBIDA",
"<a href=\"#!\" class=\"btn-floating waves-effect waves-light blue tooltipped link_traza\" data-position=\"top\" data-delay=\"50\" data-tooltip=\"Trazabilidad\" data-paquete_id=\"66\"><i class=\"material-icons\">timeline</i></a><a href=\"#!\" class=\"btn-floating waves-effect waves-light blue tooltipped btn_verdocs\" data-position=\"top\" data-delay=\"50\" data-tooltip=\"Ver documentos\" data-paquete_id=\"66\"><i class=\"material-icons\">library_books</i></a>"
]
],
"columns": "[{\"title\":\"Consecuense\",\"targets\":0},{\"title\":\"Desc\\/Desc\",\"targets\":1},{\"title\":\"\",\"targets\":2},{\"title\":\"Num. Sheets\",\"targets\":3},{\"title\":\"Tip Insert\",\"targets\":4},{\"title\":\"Cons Insert\",\"targets\":5},{\"title\":\"Bandeja\",\"targets\":6},{\"title\":\"User insert\",\"targets\":7},{\"title\":\"Date\",\"targets\":8},{\"title\":\"Usuario \",\"targets\":9},{\"title\":\"\",\"targets\":10},{\"title\":\"\",\"targets\":11},{\"title\":\"\",\"targets\":12},{\"title\":\"Acciones\",\"targets\":13}]"
}
Thank you very much and renember the DataTable have be type Server-side Porccesing
This discussion has been closed.