0

I am doing pagination using jquery datatable. My data is not exctaly table, 1 row from db say id, name, location...... i display in jsp in 3 rows like first row id,second row name then third row location...i have 1500 hunderd rows in db. For this i need to do pagination. And also when the user clicks on next link it should go to server for next records.

I know how to get the restricted number of results from server side ....

I need help for jsp configuration.....i am new to jquery...how to configure datatable.

Any ideas how to do it?

user1457957
  • 195
  • 1
  • 6
  • 21
  • Questions on SO should show the code you've tried, not be just a general request for solutions. See http://stackoverflow.com/about – Blazemonger Feb 24 '14 at 15:51

1 Answers1

1

As you can see here you can set "bProcessing": true, "bServerSide": true and the source "sAjaxSource": "yourFile.php" when you init your table.
Then on your php you have to return the same object as bellow:

{
  "sEcho": 1,
  "iTotalRecords": "57", // total number of rows
  "iTotalDisplayRecords": "57", // number of rows after the filter
  "aaData": [//your data]
}

You can see what parameters you have to use on the server-side processing reference.

Ricardo Alvaro Lohmann
  • 26,031
  • 7
  • 82
  • 82
  • Thank you Ricardo for your reply.. i understand "bProcessing": true, "bServerSide": true . but "sAjaxSource": "yourFile.php" i can not understand..... i am not using php. i am developing this application using liferay portal 6 and DAO in hibernate. In dao layer using hibernate i can get the restricted number of records to the controller. My question is what i should specify in the "sAjaxSource": and also where will i pass the page number to the controller to get the next set of records. – user1457957 Jun 19 '12 at 22:41
  • @user1457957 Look the reference at Initialisation parameters. It will explain what's ajaxSource (where're your rows' data). – Ricardo Alvaro Lohmann Jun 19 '12 at 23:11
  • i looked at reference...but all the examples are mentioning abt php files. Actually in my portlet to send a request i use . so how do set this in sAjaxsource? – user1457957 Jun 19 '12 at 23:40
  • can anybody tell me how to get the page number which user clicked? in what variable it is stroed? – user1457957 Jun 19 '12 at 23:53