<?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: Checkbox Range Selection Update</title>
	<atom:link href="http://www.barneyb.com/barneyblog/2008/05/12/checkbox-range-selection-update/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.barneyb.com/barneyblog/2008/05/12/checkbox-range-selection-update/</link>
	<description>Thoughts, rants, and even some code from the mind of Barney Boisvert.</description>
	<lastBuildDate>Thu, 11 Sep 2014 09:58:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Nirmalya</title>
		<link>https://www.barneyb.com/barneyblog/2008/05/12/checkbox-range-selection-update/comment-page-1/#comment-307303</link>
		<dc:creator>Nirmalya</dc:creator>
		<pubDate>Thu, 03 May 2012 11:33:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=407#comment-307303</guid>
		<description>Can someone make this in flex?? I mean, select checkbox range within a form. please help... thanks in advance</description>
		<content:encoded><![CDATA[<p>Can someone make this in flex?? I mean, select checkbox range within a form. please help&#8230; thanks in advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>https://www.barneyb.com/barneyblog/2008/05/12/checkbox-range-selection-update/comment-page-1/#comment-249157</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Mon, 21 Mar 2011 22:24:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=407#comment-249157</guid>
		<description>Yeah, I&#039;ll go with that; I suppose I used click because that&#039;s the event I bound to in my existing code, but change is more appropriate to what we are actually doing.

I did notice a reduction of performance with this method (curiously this was very significant with Firebug enabled, FF3.5). This is mostly down to the time taken firing all those events rather than the filter operations as far as I can tell.</description>
		<content:encoded><![CDATA[<p>Yeah, I'll go with that; I suppose I used click because that's the event I bound to in my existing code, but change is more appropriate to what we are actually doing.</p>
<p>I did notice a reduction of performance with this method (curiously this was very significant with Firebug enabled, FF3.5). This is mostly down to the time taken firing all those events rather than the filter operations as far as I can tell.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: barneyb</title>
		<link>https://www.barneyb.com/barneyblog/2008/05/12/checkbox-range-selection-update/comment-page-1/#comment-249136</link>
		<dc:creator>barneyb</dc:creator>
		<pubDate>Mon, 21 Mar 2011 19:15:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=407#comment-249136</guid>
		<description>Dan,

Good catch.  I&#039;m somewhat hesitant to trigger &#039;click&#039; like that, but your intent is sound.  It seems like a better solution would be to filter (as you&#039;ve done), set the checked state, and then trigger &#039;changed&#039;, since there isn&#039;t actually a click happening (though there obviously is a change happening).  In code, replace &quot;.click()&quot; with &quot;.attr({checked: e.target.checked ? &#039;checked&#039; : &#039;&#039;}).change()&quot;.  Thoughts?</description>
		<content:encoded><![CDATA[<p>Dan,</p>
<p>Good catch.  I'm somewhat hesitant to trigger 'click' like that, but your intent is sound.  It seems like a better solution would be to filter (as you've done), set the checked state, and then trigger 'changed', since there isn't actually a click happening (though there obviously is a change happening).  In code, replace ".click()" with ".attr({checked: e.target.checked ? 'checked' : "}).change()".  Thoughts?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>https://www.barneyb.com/barneyblog/2008/05/12/checkbox-range-selection-update/comment-page-1/#comment-249134</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Mon, 21 Mar 2011 19:01:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=407#comment-249134</guid>
		<description>Thanks for this, just to add though (And this is less efficient), my checkboxes have event handlers on them, so I have replaced the .attr calls with a filter and click functions. Works for me :)

&lt;pre&gt;
(function($) {
  $.fn.enableCheckboxRangeSelection = function() {
    var lastCheckbox = null;
    var $spec = this;
    $spec.bind(&quot;click&quot;, function(e) {

      if (lastCheckbox != null &amp;&amp; e.shiftKey) {
        $spec.slice(
          Math.min($spec.index(lastCheckbox), $spec.index(e.target)),
          Math.max($spec.index(lastCheckbox), $spec.index(e.target)) + 1
        ).filter(e.target.checked ? &quot;:not(:checked)&quot; : &quot;:checked&quot;).click();
      }
    });
    return $spec;
  };
})(jQuery);
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Thanks for this, just to add though (And this is less efficient), my checkboxes have event handlers on them, so I have replaced the .attr calls with a filter and click functions. Works for me :)</p>
<pre>
(function($) {
  $.fn.enableCheckboxRangeSelection = function() {
    var lastCheckbox = null;
    var $spec = this;
    $spec.bind("click", function(e) {

      if (lastCheckbox != null &amp;&amp; e.shiftKey) {
        $spec.slice(
          Math.min($spec.index(lastCheckbox), $spec.index(e.target)),
          Math.max($spec.index(lastCheckbox), $spec.index(e.target)) + 1
        ).filter(e.target.checked ? ":not(:checked)" : ":checked").click();
      }
    });
    return $spec;
  };
})(jQuery);
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richie</title>
		<link>https://www.barneyb.com/barneyblog/2008/05/12/checkbox-range-selection-update/comment-page-1/#comment-191318</link>
		<dc:creator>Richie</dc:creator>
		<pubDate>Thu, 17 Sep 2009 21:42:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=407#comment-191318</guid>
		<description>Cheers mate. Very useful. Would never have thought to use splice.</description>
		<content:encoded><![CDATA[<p>Cheers mate. Very useful. Would never have thought to use splice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Heilemann</title>
		<link>https://www.barneyb.com/barneyblog/2008/05/12/checkbox-range-selection-update/comment-page-1/#comment-118322</link>
		<dc:creator>Michael Heilemann</dc:creator>
		<pubDate>Sun, 24 Aug 2008 12:05:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=407#comment-118322</guid>
		<description>Awesome, thank you.</description>
		<content:encoded><![CDATA[<p>Awesome, thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: barneyb</title>
		<link>https://www.barneyb.com/barneyblog/2008/05/12/checkbox-range-selection-update/comment-page-1/#comment-118320</link>
		<dc:creator>barneyb</dc:creator>
		<pubDate>Sun, 24 Aug 2008 12:04:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=407#comment-118320</guid>
		<description>Michael,

Of course, have at it.</description>
		<content:encoded><![CDATA[<p>Michael,</p>
<p>Of course, have at it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Heilemann</title>
		<link>https://www.barneyb.com/barneyblog/2008/05/12/checkbox-range-selection-update/comment-page-1/#comment-118187</link>
		<dc:creator>Michael Heilemann</dc:creator>
		<pubDate>Sat, 23 Aug 2008 21:45:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=407#comment-118187</guid>
		<description>I&#039;m looking for just this block of code for use in &lt;a href=&quot;http://habariproject.org&quot; rel=&quot;nofollow&quot;&gt;Habari&lt;/a&gt;--short and sweet. Any chance you&#039;ll let me? :)</description>
		<content:encoded><![CDATA[<p>I'm looking for just this block of code for use in <a href="http://habariproject.org" rel="nofollow">Habari</a>&#8211;short and sweet. Any chance you'll let me? :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
