<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: How to produce a Gmail-style checkbox selection interface?</title>
	<link>http://ask.metafilter.com/38539/How-to-produce-a-Gmailstyle-checkbox-selection-interface/</link>
	<description>Comments on Ask MetaFilter post How to produce a Gmail-style checkbox selection interface?</description>
	<pubDate>Sat, 20 May 2006 03:02:30 -0800</pubDate>
	<lastBuildDate>Sat, 20 May 2006 03:02:30 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: How to produce a Gmail-style checkbox selection interface?</title>
		<link>http://ask.metafilter.com/38539/How-to-produce-a-Gmailstyle-checkbox-selection-interface</link>	
		<description>Does anyone know how it&apos;s possible to produce an interface for checkbox selection like the one in &lt;a href=&quot;http://mail.google.com&quot;&gt;Gmail&lt;/a&gt;? Namely, where you can hold down shift and click the first and last items in a list, and it&apos;ll automatically select all the ones in between. Is it possible with simple JavaScript without having to use AJAX or other fancy-pants technology...</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2006:site.38539</guid>
		<pubDate>Sat, 20 May 2006 02:07:31 -0800</pubDate>
		<dc:creator>tommorris</dc:creator>
		
			<category>javascript</category>
		
			<category>gmail</category>
		
			<category>interface</category>
		
			<category>checkboxes</category>
		
			<category>html</category>
		
			<category>xhtml</category>
		
			<category>webdesign</category>
		
			<category>forms</category>
		
	</item> <item>
		<title>By: Civil_Disobedient</title>
		<link>http://ask.metafilter.com/38539/How-to-produce-a-Gmailstyle-checkbox-selection-interface#595838</link>	
		<description>This has nothing to do with AJAX.  It is simple javascript.  Two event listeners: one monitors for the shift key, the other is an onclick (or onrelease) handler attached to each checkbox.  The system also keeps track of the last clicked position to determine which direction it should check (or uncheck) rows.  If any rows are already checked that in the &quot;path&quot; of the checking direction, they maintain their status.  &lt;br&gt;
&lt;br&gt;
The two most important things to look at when determining whether a shift-selection will be &quot;check&quot; or &quot;uncheck&quot; are the direction (based on the last selection) and the checked/unchecked status of the element you&apos;re clicking on.  If you have a group selected, then click on an unchecked box at the other end of your selection, they will all be checked (since the checked status of the last box is false).  If the checked status of the last item were instead true, it would &lt;i&gt;unselect&lt;/i&gt; the items.&lt;br&gt;
&lt;br&gt;
There&apos;s actually a bug in their selection model, if you play around with it: it appears that the last checked box becomes the new &quot;root&quot; checking node, but they aren&apos;t checking for the status of the checkbox before the shift-selection process.&lt;br&gt;
&lt;br&gt;
To illustrate: click about ten boxes in a row in the middle of the page.  #1 is the top box, #10 is the bottom box.  Then, starting at box #7, unclick some boxes in the middle working your way up (say, #6, #5, #4).  Then hold down shift and click the box directly above your selection (the equivalent of box #0).  Box #4 will &lt;i&gt;also&lt;/i&gt; get checked, because that was the last box you selected (and thus, is the current root selection).</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38539-595838</guid>
		<pubDate>Sat, 20 May 2006 03:02:30 -0800</pubDate>
		<dc:creator>Civil_Disobedient</dc:creator>
	</item><item>
		<title>By: Civil_Disobedient</title>
		<link>http://ask.metafilter.com/38539/How-to-produce-a-Gmailstyle-checkbox-selection-interface#595841</link>	
		<description>And while I&apos;m sure you just want some easy event listener code and don&apos;t care for a treatise on checkboxes, you need to understand that the &lt;i&gt;basics&lt;/i&gt; of this are pretty simple.  It&apos;s ironing out all the permutations of user behavior that will separate something like GMail from the 20-line hack-jobs that are rife with bugginess and never &lt;i&gt;quite&lt;/i&gt; work right.&lt;br&gt;
&lt;br&gt;
Anyway.  &lt;a href=&quot;http://www.webmonkey.com/webmonkey/05/10/stuff/active4.html&quot;&gt;Here is a nice key handler routine&lt;/a&gt;.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38539-595841</guid>
		<pubDate>Sat, 20 May 2006 03:09:12 -0800</pubDate>
		<dc:creator>Civil_Disobedient</dc:creator>
	</item><item>
		<title>By: zixyer</title>
		<link>http://ask.metafilter.com/38539/How-to-produce-a-Gmailstyle-checkbox-selection-interface#595843</link>	
		<description>Heh, I didn&apos;t really go as into depth into the logistics of the checkbox selecting/deselecting, but just wrote up a simple example to show that it was possible (and pretty simple JavaScript): &lt;a href=&quot;http://www.tc.umn.edu/~dean0130/test.html&quot;&gt;here&lt;/a&gt;. The source is pretty self-explanatory.  No &quot;AJAX&quot; necessary (barf).</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38539-595843</guid>
		<pubDate>Sat, 20 May 2006 03:21:30 -0800</pubDate>
		<dc:creator>zixyer</dc:creator>
	</item><item>
		<title>By: yerfatma</title>
		<link>http://ask.metafilter.com/38539/How-to-produce-a-Gmailstyle-checkbox-selection-interface#595876</link>	
		<description>Consider the value of such a thing though. You now have to make it clear to the user the option exists, as opposed to more common conventions like putting a checkbox image in the header row of a table (since it&apos;s hard to come up with a label for that column anyway) that allows users to select and unselect all. I mention this because I am a web developer and a Gmail user and had no idea what you&apos;re describing was an option.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38539-595876</guid>
		<pubDate>Sat, 20 May 2006 06:03:55 -0800</pubDate>
		<dc:creator>yerfatma</dc:creator>
	</item><item>
		<title>By: Civil_Disobedient</title>
		<link>http://ask.metafilter.com/38539/How-to-produce-a-Gmailstyle-checkbox-selection-interface#595919</link>	
		<description>zixyer, that&apos;s a nice, quick example.  Unfortunately it suffers exactly from what I was talking about.  I know it sounds like semantics, particularly since your example is just a quick mockup.  But it&apos;s these little details will drive a user crazy.  For example: click all the boxes.  Now, using your shift-select, &lt;b&gt;deselect&lt;/b&gt; all the boxes.&lt;br&gt;
&lt;br&gt;
You can&apos;t do it.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38539-595919</guid>
		<pubDate>Sat, 20 May 2006 07:52:02 -0800</pubDate>
		<dc:creator>Civil_Disobedient</dc:creator>
	</item><item>
		<title>By: zixyer</title>
		<link>http://ask.metafilter.com/38539/How-to-produce-a-Gmailstyle-checkbox-selection-interface#595957</link>	
		<description>I didn&apos;t implement deselecting.  Shift-clicking only selects boxes.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38539-595957</guid>
		<pubDate>Sat, 20 May 2006 08:39:56 -0800</pubDate>
		<dc:creator>zixyer</dc:creator>
	</item><item>
		<title>By: apple scruff</title>
		<link>http://ask.metafilter.com/38539/How-to-produce-a-Gmailstyle-checkbox-selection-interface#596019</link>	
		<description>I don&apos;t know if you specificially wanted it in Javascript, but there is a &lt;a href=&quot;http://www.squarefree.com/2005/04/13/checkrange/&quot;&gt;Greasemonkey script&lt;/a&gt; that allows you do to so.  Very basic and easy to implement.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38539-596019</guid>
		<pubDate>Sat, 20 May 2006 11:04:08 -0800</pubDate>
		<dc:creator>apple scruff</dc:creator>
	</item><item>
		<title>By: AmbroseChapel</title>
		<link>http://ask.metafilter.com/38539/How-to-produce-a-Gmailstyle-checkbox-selection-interface#596141</link>	
		<description>I don&apos;t know why &lt;strong&gt;zixyer&lt;/strong&gt; didn&apos;t get a Best Answer after the work he or she put in.&lt;br&gt;
&lt;br&gt;
Especially as the question just asks if it&apos;s &lt;em&gt;possible&lt;/em&gt;. Yes, it&apos;s possible.&lt;br&gt;
&lt;br&gt;
Just to clear up any possible remaining confusion about &quot;AJAX&quot; (a technology that, like &quot;DHTML&quot; before it, doesn&apos;t really exist): it&apos;s only AJAX if the JavaScript gets information from a server as part of the script, using XMLHTTPRequest. JavaScript changing something about a local page is just ... JavaScript.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38539-596141</guid>
		<pubDate>Sat, 20 May 2006 14:57:37 -0800</pubDate>
		<dc:creator>AmbroseChapel</dc:creator>
	</item>
	</channel>
</rss>
