2

I have a visual force page and custom controller to display order status.

I'm making a callout to a service in our servers. The process is slow to get back around 100 records. over a minute, which looks like nothing is happening for the user.

The service writers made a change that allows me to get get back partial data sets much faster than the whole set. For example "give me 20 records starting at number 40".

I'm trying to find the best user interface for this. One thought was to display the first 20 rows in a table. Then in a background process continue to load 20 records at a time, and then add them to the table as data is loaded.

Is this possible?

I'm storing the records in a list object, so that if the user refreshes the page more data could be available, but that seems clunky for the user.

1 Answer 1

3

Well there are many ways to do this

  • ActionPoller : This is VF component that lets you call apex method from the controller, you can have some context variables in the controller like the current index and till which index you want to get data and the data to you master list. Once you have this set and you are doing the rerendering the age properly you should be able to show the records. But you may have to intelligently controller the poller component.
  • ActionFunciton : Actionfuncitons are also valid candidate for doing this kind of task. You can chain ActionFunctions to retrieve the data. Or may be call the ActionFunction from oncomplete event of the same component. But make sure you are handling the loops correctly
  • JS Remoting : JS remoting is one good option, I think this would be faster and you can chain multilple request together to pull all the data to the ui. One point, since the remoting is stateless you may have to manage the current index etc variable itself on the client side / page

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .