ServerSide Processing - But no interaction with DB

ServerSide Processing - But no interaction with DB

meetshrirammeetshriram Posts: 5Questions: 0Answers: 0
edited October 2012 in General
Hi, first of all many thanks for this beautiful plug-in and offering it for free.

I've been facing a problem and unable to implement the code for it. I'm using this plug-in in my jsp and the scenario is like this...

My application is fetching all the records (1000+) from DB. This is quite fast. But I do some manipulations to the fetched data. After this manipulations I render it on the screen. Here is taking a lot of time to render 1000+ records. So I opted to use pagination which is offered by this plug-in. But this plug-in is getting applied once all the rendering happens. So decided to use server side processing. I just would like to use this server side processing to hit the same page again and again so that I can fetch only few records (my data will be present in session), manipulate it and render it on the page.

Somehow I'm failed to write logic for this. What I've implemented so far is...

[code]
("#resTab").dataTable({
bLengthChange : false,
sPaginationType : "full_numbers",
bProcessing : true,
bServerSide : true,
sAjaxSource : "data.jsp",
sServerMethod : "POST",
iTotalRecords : '<%= resultCount %>', /* As I know the total numbers of records, I'll be assigning it here*/
iTotalDisplayRecords : 100 /* Only 100 records per page*/
});
[/code]

Please refine this and recommend how to implement it.

Thanks in Advance,
Sriram

Replies

  • meetshrirammeetshriram Posts: 5Questions: 0Answers: 0
    edited October 2012
    Is it recommended to use "aaData" attribute as I fetch all the data at once? But my question here is, how the pagination works ??
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    If you want to use server-side processing you need to have your data.jsp resource implement the DataTables server-side processing protocol. It is fully documented here: http://datatables.net/usage/server-side

    Allan
  • meetshrirammeetshriram Posts: 5Questions: 0Answers: 0
    edited October 2012
    @Allan, I had gone through that doc. Somehow I'm quite confused to implement it. The doc emphasizes on getting JSON object whilst my implementation doesn't require it. I just want to hit the same page again and again to get less number of records along with pagination enabled.
  • ravimittal16ravimittal16 Posts: 2Questions: 0Answers: 0
    Hello Sir
    Did you find any solution. because i having the same problem. need to implement paging :(
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    > The doc emphasizes on getting JSON object whilst my implementation doesn't require it.

    If you want to use server-side processing, then yes it does require it. The documentation page details the exact format that must be returned from the server.

    Allan
  • meetshrirammeetshriram Posts: 5Questions: 0Answers: 0
    oh! then it's a limitation. So I've to go for "aaData" js object preparation as soon as I land in my page. But the processing time matters. Let's see how it goes. Any better recommendations for this sort of implementation?
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    You can use sAjaxDataProp to change the name of the data parameter from `aaData` to anything else you want. But yes, its a 'limitation' in that if you want to use server-side processing, you must implement server-side processing!

    Allan
This discussion has been closed.