0

I have a Rails 3 application that uses jQuery DataTable to display a list of products that a user has drilled down to. However, in the case of a generic type of product, there may be over 3,000 different products to show. It takes about 30 seconds to render the page for such result sets, even though there are only 25 visible in the datatable (I understand that they ALL render, then datatable pages through the results).

My question is, I would like to only render the first page worth of results, and only call the others if the user clicks the next or previous buttons. Is that even possible?

1
  • 2
    Possible? if it ain't the halting-problem then you can bet your bottom dollar that it's [probably] possible. Yes, it is very, very possible. Commented Mar 29, 2011 at 18:21

2 Answers 2

1

All the processing i.e. pagination, sorting, etc. can be done serverside with this plugin. This example from the plugin docs shows how to handle the server side using php (sorry, I know you are using Rails) but it might give you an idea. They key is to set

 "bServerSide": true

in the initialization of your datatable. Once you do that, you should be able to do whatever you like on the server side, instead of returning the entire dataset in one shot.

Note: Correct me if I am wrong but I assume you are using DataTables.

Sign up to request clarification or add additional context in comments.

Comments

0

Much better than doing this server side is to set bDeferRender to true. This does just what it sounds like and only renders the rows it is displaying. We found that every browser later than IE6 has a good enough JS engine to handle many thousands of rows with that option enabled.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.