<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Backbone.js: Getting The Model For A Clicked Element</title>
	<atom:link href="http://lostechies.com/derickbailey/2011/10/11/backbone-js-getting-the-model-for-a-clicked-element/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/derickbailey/2011/10/11/backbone-js-getting-the-model-for-a-clicked-element/</link>
	<description>Better Than Yesterday</description>
	<lastBuildDate>Fri, 17 May 2013 03:30:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: Alex Pavlov</title>
		<link>http://lostechies.com/derickbailey/2011/10/11/backbone-js-getting-the-model-for-a-clicked-element/#comment-3223</link>
		<dc:creator>Alex Pavlov</dc:creator>
		<pubDate>Sun, 05 May 2013 13:24:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=606#comment-3223</guid>
		<description>Is it possible to link (with &quot;a href=&#039;someView/{{id}}&#039;&quot; which is defined on Router) each list item to view?</description>
		<content:encoded><![CDATA[<p>Is it possible to link (with &#8220;a href=&#8217;someView/{{id}}&#8217;&#8221; which is defined on Router) each list item to view?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jed</title>
		<link>http://lostechies.com/derickbailey/2011/10/11/backbone-js-getting-the-model-for-a-clicked-element/#comment-2985</link>
		<dc:creator>Jed</dc:creator>
		<pubDate>Sun, 20 Jan 2013 23:13:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=606#comment-2985</guid>
		<description>Also, it makes debugging a bit more difficult. It&#039;s nice to be able to see the model id that the DOM element is associated with, without having to compare attributes or pause a click event.</description>
		<content:encoded><![CDATA[<p>Also, it makes debugging a bit more difficult. It&#8217;s nice to be able to see the model id that the DOM element is associated with, without having to compare attributes or pause a click event.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jed</title>
		<link>http://lostechies.com/derickbailey/2011/10/11/backbone-js-getting-the-model-for-a-clicked-element/#comment-2982</link>
		<dc:creator>Jed</dc:creator>
		<pubDate>Thu, 17 Jan 2013 20:23:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=606#comment-2982</guid>
		<description>This is a great demo of two approaches. Two things that are important to mention about the second approach, however, are: 1) It requires rendering in a loop, which is bad, especially with larger lists. It should be a major priority to minimize writes to the DOM; 2) It binds events to every rendered dom element in a collection, rather than binding once to the closest common ancestor and delegating from there. With a large list, this is a ton of extra noise and management. If you want to unbind the click temporarily, for example, you have to unbind many elements instead of one. The tagName thing is also a little suspect in an otherwise template-based system.</description>
		<content:encoded><![CDATA[<p>This is a great demo of two approaches. Two things that are important to mention about the second approach, however, are: 1) It requires rendering in a loop, which is bad, especially with larger lists. It should be a major priority to minimize writes to the DOM; 2) It binds events to every rendered dom element in a collection, rather than binding once to the closest common ancestor and delegating from there. With a large list, this is a ton of extra noise and management. If you want to unbind the click temporarily, for example, you have to unbind many elements instead of one. The tagName thing is also a little suspect in an otherwise template-based system.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob Nugen</title>
		<link>http://lostechies.com/derickbailey/2011/10/11/backbone-js-getting-the-model-for-a-clicked-element/#comment-2839</link>
		<dc:creator>Rob Nugen</dc:creator>
		<pubDate>Wed, 14 Nov 2012 01:20:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=606#comment-2839</guid>
		<description>Your articles are really helpful, and they could be even better if &quot;its&quot; was used at it&#039;s intended.  http://how-to-spell-its.com/ for reference.</description>
		<content:encoded><![CDATA[<p>Your articles are really helpful, and they could be even better if &#8220;its&#8221; was used at it&#8217;s intended.  <a href="http://how-to-spell-its.com/" rel="nofollow">http://how-to-spell-its.com/</a> for reference.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: LazyBucks.net</title>
		<link>http://lostechies.com/derickbailey/2011/10/11/backbone-js-getting-the-model-for-a-clicked-element/#comment-2734</link>
		<dc:creator>LazyBucks.net</dc:creator>
		<pubDate>Wed, 05 Sep 2012 20:27:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=606#comment-2734</guid>
		<description>And pretty much every instance of &quot;it&#039;s&quot; should be &quot;its.&quot; &quot;It&#039;s&quot; = &quot;it is.&quot; 


I guess that can be considered nit-picky but it&#039;s really distracting.</description>
		<content:encoded><![CDATA[<p>And pretty much every instance of &#8220;it&#8217;s&#8221; should be &#8220;its.&#8221; &#8220;It&#8217;s&#8221; = &#8220;it is.&#8221; </p>
<p>I guess that can be considered nit-picky but it&#8217;s really distracting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derick Bailey</title>
		<link>http://lostechies.com/derickbailey/2011/10/11/backbone-js-getting-the-model-for-a-clicked-element/#comment-2664</link>
		<dc:creator>Derick Bailey</dc:creator>
		<pubDate>Fri, 03 Aug 2012 01:06:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=606#comment-2664</guid>
		<description>the call to &quot;this.collection.each&quot; takes in a function as a callback to process each of the items: this.collection.each(function(item){ ... }); instead of providing an inline function directly, though, I&#039;m using &quot;this.renderItem&quot; as a callback function - basically, a method pointer. So, when the &quot;collection.each&quot; iterates over each function, it calls the &quot;renderItem&quot; function, passing the &quot;item&quot; argument along to it.




Pardon the self-promotion for a moment: if you&#039;re interested in seeing more about how this works, and all the surrounding, I have a (paid) screencast that discusses callback functions and many other ways to execute a function, here: http://www.watchmecode.net/javascript-context    There are, of course, a thousand other resources for learning more about this, online :)</description>
		<content:encoded><![CDATA[<p>the call to &#8220;this.collection.each&#8221; takes in a function as a callback to process each of the items: this.collection.each(function(item){ &#8230; }); instead of providing an inline function directly, though, I&#8217;m using &#8220;this.renderItem&#8221; as a callback function &#8211; basically, a method pointer. So, when the &#8220;collection.each&#8221; iterates over each function, it calls the &#8220;renderItem&#8221; function, passing the &#8220;item&#8221; argument along to it.</p>
<p>Pardon the self-promotion for a moment: if you&#8217;re interested in seeing more about how this works, and all the surrounding, I have a (paid) screencast that discusses callback functions and many other ways to execute a function, here: <a href="http://www.watchmecode.net/javascript-context" rel="nofollow">http://www.watchmecode.net/javascript-context</a>    There are, of course, a thousand other resources for learning more about this, online :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Craftman</title>
		<link>http://lostechies.com/derickbailey/2011/10/11/backbone-js-getting-the-model-for-a-clicked-element/#comment-2663</link>
		<dc:creator>Ryan Craftman</dc:creator>
		<pubDate>Thu, 02 Aug 2012 22:40:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=606#comment-2663</guid>
		<description>Great article - thanks. I am a complete newbie when it comes to Backbone.js. MVC and all of that is fine and we understand it, but to wrap how Backbone works in that world is taking some getting used to and I can say its definitely not easy even for someone experienced and knows everything about MVC.

Quick question because I think am a little lost.


renderItem: function(model) takes model parameter when called. 

But it is invoked like so:   this.collection.each(this.renderItem);

No model object was passed into renderItem. What am I missing? 

Thanks for the great article again.</description>
		<content:encoded><![CDATA[<p>Great article &#8211; thanks. I am a complete newbie when it comes to Backbone.js. MVC and all of that is fine and we understand it, but to wrap how Backbone works in that world is taking some getting used to and I can say its definitely not easy even for someone experienced and knows everything about MVC.</p>
<p>Quick question because I think am a little lost.</p>
<p>renderItem: function(model) takes model parameter when called. </p>
<p>But it is invoked like so:   this.collection.each(this.renderItem);</p>
<p>No model object was passed into renderItem. What am I missing? </p>
<p>Thanks for the great article again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andreas</title>
		<link>http://lostechies.com/derickbailey/2011/10/11/backbone-js-getting-the-model-for-a-clicked-element/#comment-2350</link>
		<dc:creator>Andreas</dc:creator>
		<pubDate>Thu, 12 Apr 2012 12:48:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=606#comment-2350</guid>
		<description>Thanks.

I&#039;ve seen and read about your marionette project before but right now I think I need to get a better understanding of backbone it self, having to taste the boilerplate stuff you have gone through that led you to building marionette, before I could take advantage of it.</description>
		<content:encoded><![CDATA[<p>Thanks.</p>
<p>I&#8217;ve seen and read about your marionette project before but right now I think I need to get a better understanding of backbone it self, having to taste the boilerplate stuff you have gone through that led you to building marionette, before I could take advantage of it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derick Bailey</title>
		<link>http://lostechies.com/derickbailey/2011/10/11/backbone-js-getting-the-model-for-a-clicked-element/#comment-2349</link>
		<dc:creator>Derick Bailey</dc:creator>
		<pubDate>Thu, 12 Apr 2012 12:44:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=606#comment-2349</guid>
		<description>yes. passing the raw model to a template is just going to make things difficult. you&#039;ll end up writing a lot of &quot;get(&#039;whatever&#039;)&quot; code in your templates, which will get old and frustrating fast.

fwiw, i&#039;ve wrapped up template rendering in my Backbone.Marionette framework so that I never have to think about this anymore: https://github.com/derickbailey/backbone.marionette</description>
		<content:encoded><![CDATA[<p>yes. passing the raw model to a template is just going to make things difficult. you&#8217;ll end up writing a lot of &#8220;get(&#8216;whatever&#8217;)&#8221; code in your templates, which will get old and frustrating fast.</p>
<p>fwiw, i&#8217;ve wrapped up template rendering in my Backbone.Marionette framework so that I never have to think about this anymore: https://github.com/derickbailey/backbone.marionette</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andreas</title>
		<link>http://lostechies.com/derickbailey/2011/10/11/backbone-js-getting-the-model-for-a-clicked-element/#comment-2348</link>
		<dc:creator>Andreas</dc:creator>
		<pubDate>Thu, 12 Apr 2012 12:42:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=606#comment-2348</guid>
		<description>so you always pass your models and collections as json to your templates?</description>
		<content:encoded><![CDATA[<p>so you always pass your models and collections as json to your templates?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
