How get number of pagination of Datatable?

How get number of pagination of Datatable?

OrorokOrorok Posts: 2Questions: 1Answers: 0

Hello, I have tried to save the page value of a datatable and then send it by POST.

I have been seeing information about it and I have found codes like these:

var table = $ ('# dataTables-example'). DataTable ();
      var info = table.page.info ();
      var index = info.page + 1;

and fnDrawCallback or fnInfoCallback

 ... However, it's taking me a while and I thought you guys might already have a code that does that and helps me.

I just need get the page value into an input hidden, then I already know what to do.

Thank you.

Answers

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954

    Looks like you have a space between # and dataTables-example in var table = $ ('# dataTables-example'). DataTable ();. This won't work. It needs to be ('#dataTables-example') for the jQuery selector to work properly.

    Kevin

  • OrorokOrorok Posts: 2Questions: 1Answers: 0

    Oops, that space was put when translating the text. Originally it was not there.

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954

    Does that mean you have it working now?

    Kevin

This discussion has been closed.