[ 4 posts ]

ispyinternet

  • Joined: Thu Jul 08, 2010 5:28 am
  • Posts: 111
  • Offline
  • Profile

view render dependent on multiple data sources

Post Posted: Thu May 31, 2012 11:44 am
+0-
I have a view, and on initialisation it makes say 3 remote calls for data models, I currently have an after "load" event for each of the models which requests a 're-render'.

a couple of questions, as the data comes in and starts the render lifecycle, what happens when the view is currently in a render lifecycle and another data load event requests a 're-render' - does it wait until its finished the current render and then re-render again?

If so what is the best way to program such a model? because if the DOM render were expensive I would have thought waiting for all data sources to be complete loading then rendering the DOM would be the preferred scenario?

What would be the neat way to code this?

Thanks

Richard.

Daniel Ji

  • Username: humblepie
  • Joined: Tue Feb 28, 2012 10:30 am
  • Posts: 147
  • GitHub: humblepie
  • Gists: humblepie
  • Offline
  • Profile
Tags:

Re: view render dependent on multiple data sources

Post Posted: Thu May 31, 2012 4:42 pm
+0-
Hey Richard,

I'd say it depends on what you do with the payloads from the 3 remote calls. If you need to display the info from all 3 payloads simultaneously then you should just wait until all 3 payloads are received, then make a single render() call.

If each of the payloads can be used independently to draw an independent piece of the view, then at that point, perhaps create sub-views and models for each of the remote calls you refer to.

Eric Ferraiuolo

YUI Developer

  • Username: ericf
  • Joined: Mon Jan 12, 2009 8:26 pm
  • Posts: 380
  • Location: Boston, MA
  • Twitter: ericf
  • GitHub: ericf
  • Gists: ericf
  • IRC: eric_f
  • YUI Developer
  • Offline
  • Profile
Tags:

Re: view render dependent on multiple data sources

Post Posted: Wed Jun 06, 2012 9:11 am
+0-
Y.Parallel can help with this sort of thing: http://yuilibrary.com/yui/docs/yui/parallel.html

Daniel Ji

  • Username: humblepie
  • Joined: Tue Feb 28, 2012 10:30 am
  • Posts: 147
  • GitHub: humblepie
  • Gists: humblepie
  • Offline
  • Profile
Tags:

Re: view render dependent on multiple data sources

Post Posted: Wed Jun 06, 2012 9:15 am
+0-
Wow, that can be pretty useful. Thanks for sharing, Eric.
  [ 4 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum