How to put table on page "x"?

How to put table on page "x"?

diego703diego703 Posts: 2Questions: 0Answers: 0

Hello, first I want to thank the developers for this amazing tool :).
Now as for my question, I want to know if it is possible to redraw the table on a page "x"; example.
enter on the page, and displays the table on page 5.

datatable use bootstrap 1.10.
I get the data from the "server-side processing" server.

try several times and ways, one of them is this: "tab.page(5).draw(false);" (This works with a static table, but not "server-side"). I understand the reason why this does not work, that's why I seek an alternative.

Greatly appreciate your help, showing me any way you could do this.

Thanks for your time.


hola, primero quiero agradecer a los desarrolladores por esta increíble herramienta :).
Ahora en cuanto a mi pregunta, quiero saber si es posible redibujar la tabla en una pagina "x"; ejemplo.
entro en la pagina, y muestra la tabla en la pagina 5.

utilizo datatable bootstrap 1.10.
obtengo los datos desde el servidor "server-side processing".

intente varias veces y formas, una de ellas es esta: "$('#table').DataTable().page(5).draw();" (Lo anterior funciona con una tabla estatica, pero no con "server-side"). Entiendo la razon por la que esto no funciona, es por eso que busco una alternativa.

Agradeceria enormemente su ayuda, mostrandome alguna forma de poder realizar esto.

por su tiempo gracias.

$(document).ready( function () {
 var tab=$('#table').DataTable({
                    "bProcessing": true,
                    "bServerSide": true,
                    "sAjaxSource": "<?php echo $this->url('url_page') ?>",
                    "order": [ 0, "desc" ],
                    "columnDefs": [ { 
                        "targets": 5, 
                        "orderable": false 
                    } ],
});

tab.page(5).draw(false);
} );

(The code was simplified.)
(El código fue simplificado.)

Replies

  • allanallan Posts: 61,798Questions: 1Answers: 10,115 Site admin

    if it is possible to redraw the table on a page "x"; example. enter on the page, and displays the table on page 5.

    Yes, the page() method that you have used. However, if you want it to perform that action immediately on initialisation you would be best using the displayStart option.

    Allan

  • diego703diego703 Posts: 2Questions: 0Answers: 0
    edited May 2015

    Yes, the page()DT method that you have used. However, if you want it to perform that action immediately on initialisation you would be best using the displayStartDT option.

    thanks for your answer, I tried some cases, and it worked well. thanks.

    diego.-

This discussion has been closed.