Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery Datatables. How can I change the current page programmatically?

I have pagination on my table. I want go back back to the first page whenever a function is called. How can I do that?

like image 904
code511788465541441 Avatar asked May 11 '13 10:05

code511788465541441


2 Answers

from the docs: http://datatables.net/ref#fnPageChange

$(document).ready(function() {
  var oTable = $('#example').dataTable();
  oTable.fnPageChange( 'first' );
} );
like image 161
carrabino Avatar answered Sep 22 '22 14:09

carrabino


var oTable = $('#example').dataTable();
oTable.fnPageChange( 'first' );

OR

oTable.fnPageChange( 0 );
like image 32
Mohammad Adil Avatar answered Sep 19 '22 14:09

Mohammad Adil