<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>EyedMax's Pit &#187; JS/Ajax</title>
	<atom:link href="http://eyedmax.com/tag/jsajax/feed/" rel="self" type="application/rss+xml" />
	<link>http://eyedmax.com</link>
	<description>Yeah, you're right. It's me ;)</description>
	<lastBuildDate>Sat, 05 Sep 2009 00:44:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<image>
  <link>http://eyedmax.com</link>
  <url>http://eyedmax.com/favicon.ico</url>
  <title>EyedMax's Pit</title>
</image>
		<item>
		<title>Advanced Scriplaculous Sortable Demo Fix</title>
		<link>http://eyedmax.com/2009/04/20/advanced-scriplaculous-sortable-demo/</link>
		<comments>http://eyedmax.com/2009/04/20/advanced-scriplaculous-sortable-demo/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 00:22:01 +0000</pubDate>
		<dc:creator>eyedmax</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[JS/Ajax]]></category>

		<guid isPermaLink="false">http://eyedmax.com/?p=198</guid>
		<description><![CDATA[Heh.
There is a good example of using nested Scriplaculous Sortables. With one little flaw &#8211; Scriplaculous ver 1.6.x is used, and when you try to execute the code with newer version of library &#8211; sections.each is not a function error pops up.  
Here is the way to fix it &#8211; you&#8217;ll probably need it [...]]]></description>
			<content:encoded><![CDATA[<p>Heh.</p>
<p>There is a <a href="http://www.gregphoto.net/index.php/2006/05/30/updated-scriplaculous-sortable-demo/" target="_blank">good example</a> of using nested Scriplaculous Sortables. With one little flaw &#8211; Scriplaculous ver 1.6.x is used, and when you try to execute the code with newer version of library &#8211; <span style="color: #ff0000;">sections.each is not a function</span> error pops up.  </p>
<p>Here is the way to fix it &#8211; you&#8217;ll probably need it if you want to save the results <img src='http://eyedmax.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' />   </p>
<p>Just replace &#8220;document.getElementsByClassName(&#8217;section&#8217;);&#8221; to &#8220;$$(&#8216;.section&#8217;);&#8221;  </p>
<p><strong>Before</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> getGroupOrder<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> sections <span style="color: #339933;">=</span> document<span style="color: #339933;">.</span>getElementsByClassName<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'section'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">var</span> alerttext <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	sections<span style="color: #339933;">.</span><span style="color: #990000;">each</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>section<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> sectionID <span style="color: #339933;">=</span> section<span style="color: #339933;">.</span>id<span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">var</span> order <span style="color: #339933;">=</span> Sortable<span style="color: #339933;">.</span><span style="color: #990000;">serialize</span><span style="color: #009900;">&#40;</span>sectionID<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		alerttext <span style="color: #339933;">+=</span> sectionID <span style="color: #339933;">+</span> <span style="color: #0000ff;">': '</span> <span style="color: #339933;">+</span> Sortable<span style="color: #339933;">.</span>sequence<span style="color: #009900;">&#40;</span>section<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">'\n'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	alert<span style="color: #009900;">&#40;</span>alerttext<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>After</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> getGroupOrder<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> sections <span style="color: #339933;">=</span> $$<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'.section'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">var</span> alerttext <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	sections<span style="color: #339933;">.</span><span style="color: #990000;">each</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>section<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> sectionID <span style="color: #339933;">=</span> section<span style="color: #339933;">.</span>id<span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">var</span> order <span style="color: #339933;">=</span> Sortable<span style="color: #339933;">.</span><span style="color: #990000;">serialize</span><span style="color: #009900;">&#40;</span>sectionID<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		alerttext <span style="color: #339933;">+=</span> sectionID <span style="color: #339933;">+</span> <span style="color: #0000ff;">': '</span> <span style="color: #339933;">+</span> Sortable<span style="color: #339933;">.</span>sequence<span style="color: #009900;">&#40;</span>section<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">'\n'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	alert<span style="color: #009900;">&#40;</span>alerttext<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Then modify it for your needs and go on )</p>
<p>What was that?<br />
Quote:</p>
<blockquote><p>As of Prototype 1.6, document.getElementsByClassName has been deprecated since native implementations return a NodeList rather than an Array.</p></blockquote>
<img src="http://eyedmax.com/?ak_action=api_record_view&id=198&type=feed" alt="" />
	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://eyedmax.com/2007/03/27/youthumb-another-video-plugin/" title="youthumb &#8211; another video plugin (March 27, 2007)">youthumb &#8211; another video plugin</a> (0)</li>
	<li><a href="http://eyedmax.com/2007/06/23/utf-8-fix-when-charset-is-set-to-latin1/" title="UTF-8 fix &#8211; when charset is set to Latin1 (June 23, 2007)">UTF-8 fix &#8211; when charset is set to Latin1</a> (0)</li>
	<li><a href="http://eyedmax.com/2007/06/26/scrap/" title="Scrap (June 26, 2007)">Scrap</a> (0)</li>
	<li><a href="http://eyedmax.com/2007/05/31/php-4-and-xml/" title="PHP 4 and XML (May 31, 2007)">PHP 4 and XML</a> (0)</li>
	<li><a href="http://eyedmax.com/2008/05/28/fixed-boxover-js-library/" title="Fixed BoxOver js library (May 28, 2008)">Fixed BoxOver js library</a> (3)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://eyedmax.com/2009/04/20/advanced-scriplaculous-sortable-demo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
