how to get SUM with Server-side-processing ?

how to get SUM with Server-side-processing ?

Keyser_SozeKeyser_Soze Posts: 22Questions: 0Answers: 0
edited February 2011 in General
Hi,

Thanks for this great plugin :)

I'm facing a problem and i'm stuck. I have tables using server-side-processing and i need to get SUM for columns.
I tried to search on this forum but i can't find the solution.

Please could anyone show me how to do this or give me a link that explain the procedure and how it works.

Thanks.

Replies

  • GregPGregP Posts: 500Questions: 10Answers: 0
    I think the question is a bit too general. Everything depends on the server-side code that is returning your data. If you're using Allan's PHP example code, keep in mind that they are just that--examples of how you MIGHT get data back from the server side.

    So you really have two choices: develop some server-side code that returns your sum (you could probably sneak it into a hidden row, or anywhere else that data can be returned), or on the client side grab the contents of your column and sum them with JavaScript. If you do it client-side, just remember that you will only have access to data that's in the page. Usually server-side processing is used because you have thousands of records and only want to display a subset... that being the case, a client-side sum would only tally up the subset.
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    If you want to use the data that is available on the client-side then you can do something like this: http://datatables.net/examples/advanced_init/footer_callback.html . If however you need the full data set, then as Greg suggests, you'll probably need to add another SQL query to the server-side processing script and pull out the information you need.

    Allan
This discussion has been closed.