datatable server side pagination doesn't work
datatable server side pagination doesn't work
lishu
Posts: 6Questions: 2Answers: 0
Even returning this:
"recordsTotal": 17,
"recordsFiltered": 10,
the datatable, show only one page in the paginator section.
Does somebody try this in the new versión?
here you can see my problem:
http://i58.tinypic.com/miz9kz.jpg
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Perhaps your server-side script only requests 10 records, but as you don't provide any code I can't say.
You are telling it there are only 10 records int he filtered results, so assuming your page length is the default of 10, then it is correct, there is only 1 page.
Might be worth re-reading the documentation:
Allan
ok thanks Allan.
and tell me how to say:
Total records: 1.000
Total records with this filter 200
total records to show: 10..
tell me if i am wrong, but the idea of server side is not bring all database to client side, just necesarry records.
so if i said that i am showing 10 records, and total records are 1000, the pagination should do the pagination based on the total records..
or i am wrong?
Thanks regards.
Thanks tangerine for your reply.
The documentation define which fields should return.
But, there is no example of pagination.
because all the example always return 57 records as total.
This is my entire code:
as you can see, the total records in DB are 13 but i just want to return 10.
{ "draw":1,
"recordsTotal": 13,
"recordsFiltered": 10,
"data":[{"DT_RowId": "fila_22", "0":22, "1":"Hospital de Claudio2", "2":"<a href='javascript:Editar(22)'><span class='glyphicon glyphicon-pencil' title='Editar'></span></a><a href='javascript:mostrarEliminar(22)'><span class='glyphicon glyphicon-remove' title='Eliminar'></span></a>"},{"DT_RowId": "fila_20", "0":20, "1":"cree uno nuevo", "2":"<a href='javascript:Editar(20)'><span class='glyphicon glyphicon-pencil' title='Editar'></span></a><a href='javascript:mostrarEliminar(20)'><span class='glyphicon glyphicon-remove' title='Eliminar'></span></a>"},{"DT_RowId": "fila_16", "0":16, "1":"asd", "2":"<a href='javascript:Editar(16)'><span class='glyphicon glyphicon-pencil' title='Editar'></span></a><a href='javascript:mostrarEliminar(16)'><span class='glyphicon glyphicon-remove' title='Eliminar'></span></a>"},{"DT_RowId": "fila_15", "0":15, "1":"aqwe ", "2":"<a href='javascript:Editar(15)'><span class='glyphicon glyphicon-pencil' title='Editar'></span></a><a href='javascript:mostrarEliminar(15)'><span class='glyphicon glyphicon-remove' title='Eliminar'></span></a>"},{"DT_RowId": "fila_14", "0":14, "1":"gh", "2":"<a href='javascript:Editar(14)'><span class='glyphicon glyphicon-pencil' title='Editar'></span></a><a href='javascript:mostrarEliminar(14)'><span class='glyphicon glyphicon-remove' title='Eliminar'></span></a>"},{"DT_RowId": "fila_13", "0":13, "1":"gh", "2":"<a href='javascript:Editar(13)'><span class='glyphicon glyphicon-pencil' title='Editar'></span></a><a href='javascript:mostrarEliminar(13)'><span class='glyphicon glyphicon-remove' title='Eliminar'></span></a>"},{"DT_RowId": "fila_12", "0":12, "1":"asdqwe", "2":"<a href='javascript:Editar(12)'><span class='glyphicon glyphicon-pencil' title='Editar'></span></a><a href='javascript:mostrarEliminar(12)'><span class='glyphicon glyphicon-remove' title='Eliminar'></span></a>"},{"DT_RowId": "fila_10", "0":10, "1":"asd", "2":"<a href='javascript:Editar(10)'><span class='glyphicon glyphicon-pencil' title='Editar'></span></a><a href='javascript:mostrarEliminar(10)'><span class='glyphicon glyphicon-remove' title='Eliminar'></span></a>"},{"DT_RowId": "fila_7", "0":7, "1":"sssswwwww77", "2":"<a href='javascript:Editar(7)'><span class='glyphicon glyphicon-pencil' title='Editar'></span></a><a href='javascript:mostrarEliminar(7)'><span class='glyphicon glyphicon-remove' title='Eliminar'></span></a>"},{"DT_RowId": "fila_4", "0":4, "1":"lishu", "2":"<a href='javascript:Editar(4)'><span class='glyphicon glyphicon-pencil' title='Editar'></span></a><a href='javascript:mostrarEliminar(4)'><span class='glyphicon glyphicon-remove' title='Eliminar'></span></a>"}]}
Thanks tangerine for your reply.
The documentation define which fields should return.
But, there is no example of pagination.
because all the example always return 57 records as total.
This is my entire code:
as you can see, the total records in DB are 13 but i just want to return 10.
{ "draw":1,
"recordsTotal": 13,
"recordsFiltered": 10,
"data":[{"DT_RowId": "fila_22", "0":22, "1":"Hospital de Claudio2", "2":"<a href='javascript:Editar(22)'><span class='glyphicon glyphicon-pencil' title='Editar'></span></a><a href='javascript:mostrarEliminar(22)'><span class='glyphicon glyphicon-remove' title='Eliminar'></span></a>"},{"DT_RowId": "fila_20", "0":20, "1":"cree uno nuevo", "2":"<a href='javascript:Editar(20)'><span class='glyphicon glyphicon-pencil' title='Editar'></span></a><a href='javascript:mostrarEliminar(20)'><span class='glyphicon glyphicon-remove' title='Eliminar'></span></a>"},{"DT_RowId": "fila_16", "0":16, "1":"asd", "2":"<a href='javascript:Editar(16)'><span class='glyphicon glyphicon-pencil' title='Editar'></span></a><a href='javascript:mostrarEliminar(16)'><span class='glyphicon glyphicon-remove' title='Eliminar'></span></a>"},{"DT_RowId": "fila_15", "0":15, "1":"aqwe ", "2":"<a href='javascript:Editar(15)'><span class='glyphicon glyphicon-pencil' title='Editar'></span></a><a href='javascript:mostrarEliminar(15)'><span class='glyphicon glyphicon-remove' title='Eliminar'></span></a>"},{"DT_RowId": "fila_14", "0":14, "1":"gh", "2":"<a href='javascript:Editar(14)'><span class='glyphicon glyphicon-pencil' title='Editar'></span></a><a href='javascript:mostrarEliminar(14)'><span class='glyphicon glyphicon-remove' title='Eliminar'></span></a>"},{"DT_RowId": "fila_13", "0":13, "1":"gh", "2":"<a href='javascript:Editar(13)'><span class='glyphicon glyphicon-pencil' title='Editar'></span></a><a href='javascript:mostrarEliminar(13)'><span class='glyphicon glyphicon-remove' title='Eliminar'></span></a>"},{"DT_RowId": "fila_12", "0":12, "1":"asdqwe", "2":"<a href='javascript:Editar(12)'><span class='glyphicon glyphicon-pencil' title='Editar'></span></a><a href='javascript:mostrarEliminar(12)'><span class='glyphicon glyphicon-remove' title='Eliminar'></span></a>"},{"DT_RowId": "fila_10", "0":10, "1":"asd", "2":"<a href='javascript:Editar(10)'><span class='glyphicon glyphicon-pencil' title='Editar'></span></a><a href='javascript:mostrarEliminar(10)'><span class='glyphicon glyphicon-remove' title='Eliminar'></span></a>"},{"DT_RowId": "fila_7", "0":7, "1":"sssswwwww77", "2":"<a href='javascript:Editar(7)'><span class='glyphicon glyphicon-pencil' title='Editar'></span></a><a href='javascript:mostrarEliminar(7)'><span class='glyphicon glyphicon-remove' title='Eliminar'></span></a>"},{"DT_RowId": "fila_4", "0":4, "1":"lishu", "2":"<a href='javascript:Editar(4)'><span class='glyphicon glyphicon-pencil' title='Editar'></span></a><a href='javascript:mostrarEliminar(4)'><span class='glyphicon glyphicon-remove' title='Eliminar'></span></a>"}]}