Views 3 pluggable backends : is this what i need ?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
redben's picture

I am working on a project which involves querying a web service. A hotel search service.
So instead of going with custom standalone code, i'd like to see if i can implement this while building up on views.
Now that Views 3 has pluggable backends, may be it is possible for me to use it, but i need some clarification :

  1. The web service i'll call is asynchronous : query it and give it a callback url so that it can reply later with the results.
  2. Since it is async and i need the module to be user friendly, i need a way to show the user a "Wait..." screen (may be batch api, or plain ajax ?) while waiting for the response.

Can i do all this just by extending views ? can query->execute be async ?
If not, may be handle the web service call and the wait screen separately and, when i get the result, store it somewhere and use my views backend to show the result as a view.

Any advice would be much appreciated !

Comments

What you could do is to

dawehner's picture

What you could do is to return empty results by default and use some ctools ajax goodness to replace the html later when you get a result.

In your callback you could set the $view->result and run the view again.
In theory you should be able to render the view then.

Thanks for the suggestions

redben's picture

Thanks for the suggestions dereine. This indeed would work for my case. But for now i think i'll begin with the simplest approach, which is to manage the form and the web service call outside views, and when the response is ready, call the view on the response cache.
Hoping to see async results on views 4.x :)

Views Developers

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week