[ 3 posts ]

ispyinternet

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

gallery-model-relate query

Post Posted: Wed Apr 18, 2012 2:00 am
+0-
when using gallery-model-relate I was under the impression that when data in one model changed the relationships were all updated.

Can anybody who uses / knows this module confirm and please look at the following code which doesn't appear to work as I would expect:

http://jsfiddle.net/DwQsb/3/

Thanks

Richard.

Steven Olmsted

YUI Contributor

  • Username: solmsted
  • Joined: Wed Apr 14, 2010 1:47 pm
  • Posts: 82
  • Location: Richmond, VA
  • GitHub: solmsted
  • Gists: solmsted
  • IRC: solmsted
  • Offline
  • Profile

Re: gallery-model-relate query

Post Posted: Wed Apr 18, 2012 7:20 pm
+0-
This is tricky, but I think I see what's going on here. Yes, the modelLists returned by gallery-model-relate will automatically update as the model data is changed. In your fiddle, you aren't actually changing any model data. You are destroying a model.

gallery-model-relate internally uses gallery-model-store to hold on to a reference of all model instances. Even if you've destroyed a model, it is still in the model store, and its data is still in tact. This is why you aren't seeing your modelLists update automatically.

I've slightly modified the fiddle to remove the model from the model store at the same time it gets destroyed. I think this yields the results your are looking for. http://jsfiddle.net/DwQsb/16/.

ispyinternet

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

Re: gallery-model-relate query

Post Posted: Thu Apr 19, 2012 1:06 am
+0-
thanks for this, i am not sure why this would not be automatically handled by the model-relate?

what do you think?
  [ 3 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