<?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>existdissolve.com &#187; Spry Framework</title>
	<atom:link href="http://existdissolve.com/category/javascript/spry-framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://existdissolve.com</link>
	<description>the singularity of being and nothingness</description>
	<lastBuildDate>Wed, 16 May 2012 12:54:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>New Spry Enhancements</title>
		<link>http://existdissolve.com/2010/05/new-spry-enhancements/</link>
		<comments>http://existdissolve.com/2010/05/new-spry-enhancements/#comments</comments>
		<pubDate>Sat, 01 May 2010 06:28:28 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[Spry Framework]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Spry]]></category>

		<guid isPermaLink="false">http://existdissolvetest.wordpress.com/2010/05/01/new-spry-enhancements</guid>
		<description><![CDATA[Even though I&#039;ve pretty much given up on Adobe&#039;s Spry Framework, I noticed yesterday that some major updates have been added in, primary among them the introduction of Spry UI.&#160; According to the Spry Team&#039;s blog post, Spry UI is a new way of approaching Spry widgets that moves away from the previous (and kind&#8230;]]></description>
			<content:encoded><![CDATA[<p>Even though I&#039;ve pretty much given up on Adobe&#039;s Spry Framework, I noticed yesterday that some major updates have been added in, primary among them the introduction of <a href="http://labs.adobe.com/technologies/spry/ui/">Spry UI</a>.&nbsp; According to the Spry Team&#039;s <a href="http://blogs.adobe.com/spryteam/">blog post</a>, Spry UI is a new way of approaching Spry widgets that moves away from the previous (and kind of annoying) necessity of following a prescribed markup model and now attempts to work with user-defined patterns.&nbsp; This *should* allow for much more flexibility and customizability, and allow for much more robust opportunities for skinning that were previously possible.&nbsp; Moreover, because all the widgets will now inherit from the same shared base classes, the door is widened for Spry to become a much more robust framework in the future. </p>
<p>Does the introduction of Spry UI mean that Spry development is alive and well, and that Adobe is committed to making something of it long term?&nbsp; Only time will tell.&nbsp; </p>
<p>The problem for me, of course, is that <em><strong>time</strong></em> is precisely the problem.&nbsp; Development of the framework has been seemingly eternal, and significant updates (whether features or simply information about ongoing development) are VERY infrequent.&nbsp; While I see a lot of promise in what Spry can do (and can become), &quot;facts on the ground&quot; force me to use other, more mature frameworks for serious development. &nbsp;</p>
<p>I don&#039;t mean this as a slight to Spry, nor to the talented Spry team (or even the thousands of developers who make really good use of it).&nbsp; The bottom line for me is that I need a framework <em><strong>today</strong></em> that has the fully formed features of a jQuery or Ext.&nbsp; If Spry Framework is in that position <em><strong>tomorrow</strong></em>, I&#039;ll more than happily give it a another chance. </p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2010/05/new-spry-enhancements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Spry Data with Thickbox</title>
		<link>http://existdissolve.com/2009/05/using-spry-data-with-thickbox/</link>
		<comments>http://existdissolve.com/2009/05/using-spry-data-with-thickbox/#comments</comments>
		<pubDate>Fri, 15 May 2009 14:52:28 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Spry Framework]]></category>
		<category><![CDATA[Spry]]></category>
		<category><![CDATA[Thickbox]]></category>

		<guid isPermaLink="false">http://existdissolvetest.wordpress.com/2009/05/15/using-spry-data-with-thickbox</guid>
		<description><![CDATA[If you&#039;ve ever tried to use Spry data sets with a default implementation of Thickbox (a jQuery-based version of the familiar Lightbox), you&#039;ve probably noticed that it doesn&#039;t work. The reason for this, of course, is simple: out of the gates, thickbox.js fires off an initialization function (tb_init) through jQuery&#039;s ready().&#160; What this means, technically,&#8230;]]></description>
			<content:encoded><![CDATA[<p>If you&#039;ve ever tried to use Spry data sets with a default implementation of <a href="http://jquery.com/demo/thickbox/">Thickbox</a> (a jQuery-based version of the familiar Lightbox), you&#039;ve probably noticed that it doesn&#039;t work.</p>
<p>The reason for this, of course, is simple: out of the gates, thickbox.js fires off an initialization function (tb_init) through jQuery&#039;s ready().&nbsp; What this means, technically, is that thickbox has already started its processing and element fishing before Spry&#039;s data sets have been fully loaded and rendered.&nbsp; What this means, practically, is that Thickbox won&#039;t work.</p>
<p>Though frustrating, there is a fairly simple way to work around this. &nbsp;</p>
<p>Conceptually, what we&#039;ll be doing is to bypass jQuery&#039;s ready() function and load tb_init manually AFTER we know Spry&#039;s data sets have fully loaded and rendered.</p>
<p><strong>First</strong>, we need to figure out when the data sets are done processing.&nbsp; This is pretty simple, because Spry comes with a handy way of sniffing this out.</p>
<p>We&#039;ll start by setting up a new data region observer.&nbsp; Our observer will watch the data set and when it reaches the &quot;state&quot; that we define, we can manually fire the thickbox.js processing.</p>
<p>So here&#039;s our new observer:</p>
<p><strong>the_Observer= new Object()<br />the_Observer.onPostUpdate = function() {<br />&nbsp;&nbsp; // Here&#039;s where the thickbox function call will go&#8230;&nbsp;&nbsp; &nbsp;<br />};</strong></p>
<p><strong>Spry.Data.Region.addObserver(&quot;the_region&quot;, the_Observer); </strong></p>
<p>Nothing too complicated here.&nbsp; We create a new Spry region observer, tell it to watch for the &quot;onPostUpdate&quot; state, and then we can load in whatever processing we want to the function we&#039;ve defined for that state.</p>
<p>The next step, then, is to load in the thickbox initialization function.</p>
<p>To do this, start by going to the thickbox.js file.&nbsp; Copy the following lines:</p>
<p><strong>tb_init(&#039;a.thickbox, area.thickbox, input.thickbox&#039;);<br />imgLoader = new Image();// preload image<br />imgLoader.src = tb_pathToImage;</strong></p>
<p>Once you have them copied, go ahead and comment out the entire $(document).ready function, including the lines you just copied.&nbsp; Save and close.</p>
<p>Go back to your other page and paste the three lines into our observer function.&nbsp; The final result will look something like this:</p>
<p><strong>the_Observer= new Object()<br />the_Observer.onPostUpdate = function() {<br />&nbsp;&nbsp; &nbsp;// See?&nbsp; Here&#039;s the init function for thickbox&#8230;<br />&nbsp;&nbsp; &nbsp;tb_init(&#039;a.thickbox, area.thickbox, input.thickbox&#039;);<br />&nbsp;&nbsp;&nbsp; &nbsp;imgLoader = new Image();// preload image<br />&nbsp;&nbsp;&nbsp; &nbsp;imgLoader.src = tb_pathToImage;<br />};</p>
<p>Spry.Data.Region.addObserver(&quot;products&quot;, the_Observer);</strong> </p>
<p>That&#039;s all there is to it.&nbsp; Now your Thickbox content should work correctly.</p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2009/05/using-spry-data-with-thickbox/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Checking if Spry eventListener Exists</title>
		<link>http://existdissolve.com/2009/05/checking-if-spry-eventlistener-exists/</link>
		<comments>http://existdissolve.com/2009/05/checking-if-spry-eventlistener-exists/#comments</comments>
		<pubDate>Sun, 03 May 2009 10:07:14 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[Spry Framework]]></category>
		<category><![CDATA[eventListeners]]></category>
		<category><![CDATA[Spry]]></category>

		<guid isPermaLink="false">http://existdissolvetest.wordpress.com/2009/05/03/checking-if-spry-eventlistener-exists</guid>
		<description><![CDATA[So if you use Spry, you know that adding an eventListener to anything is super-simple.&#160; It&#039;s easy to add, and managing the processing that occurs on events is pretty intuitive.&#160; For example: Spry.Utils.addEventListener(&#34;myButton&#34;,&#34;click&#34;,doMyFunction,false); This one line of code adds an eventListener to the element &#34;myButton&#34; for the onclick event, which will fire &#34;doMyFunction()&#34;.&#160; And it&#039;s&#8230;]]></description>
			<content:encoded><![CDATA[<p>So if you use Spry, you know that adding an eventListener to anything is super-simple.&nbsp; It&#039;s easy to add, and managing the processing that occurs on events is pretty intuitive.&nbsp; </p>
<p>For example:</p>
<p><strong>Spry.Utils.addEventListener(&quot;myButton&quot;,&quot;click&quot;,doMyFunction,false);</strong></p>
<p>This one line of code adds an eventListener to the element &quot;myButton&quot; for the onclick event, which will fire &quot;doMyFunction()&quot;.&nbsp; And it&#039;s just as easy to remove the same eventListener:<br /><strong><br />Spry.Utils.removeEventListener(&quot;myButton&quot;,&quot;click&quot;,doMyFunction,false);</strong></p>
<p>Easy enough.&nbsp; However, I recently found myself wanting to not only add and remove eventListeners, but also to check if they exist for certain elements.&nbsp; Luckily, before digging into the DOM to much, I checked SpryDOMUtils.js&#8211;sure enough, there&#039;s a function already built for this.</p>
<p>In fact, as you may or may not be aware, you can run Spry.Utils.addEventListener() on an element as many times as you like&#8211;only one eventListener will be registered.&nbsp; This is because addEventListener() runs a check to see if the eventListener is already registered, and proceeds from there (look at line 166 in SpryDOMUtils.js v. 0.6 to see this in action).</p>
<p>So checking to see if an eventListener is registered for an element is exactly the same as adding and removing the eventListener.&nbsp; Here&#039;s what it looks like:</p>
<p><strong>Spry.Utils.eventListenerIsBoundToElement(&quot;myButton,&quot;click&quot;,doMyFunction,false);</strong></p>
<p>This will return true or false, and you can do whatever you&#039;d like from there.&nbsp; </p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2009/05/checking-if-spry-eventlistener-exists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Manipulating Spry Datasets in the DOM</title>
		<link>http://existdissolve.com/2009/05/manipulating-spry-datasets-in-the-dom/</link>
		<comments>http://existdissolve.com/2009/05/manipulating-spry-datasets-in-the-dom/#comments</comments>
		<pubDate>Fri, 01 May 2009 12:26:13 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[Spry Framework]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[Spry]]></category>

		<guid isPermaLink="false">http://existdissolvetest.wordpress.com/2009/05/01/manipulating-spry-datasets-in-the-dom</guid>
		<description><![CDATA[I recently created a little peice of functionality using Spry data to setup two lists that can swap data on the fly, without the need for any postbacks to the server.&#160; I&#039;ve done this thing several times before, but in the past, I&#039;ve done it very inefficiently.&#160; Let me give you an example. Let&#039;s say&#8230;]]></description>
			<content:encoded><![CDATA[<p>I recently created a little peice of functionality using Spry data to setup two lists that can swap data on the fly, </p>
<p>without the need for any postbacks to the server.&nbsp; I&#039;ve done this thing several times before, but in the past, I&#039;ve done it very inefficiently.&nbsp; Let me give you an example.</p>
<p>Let&#039;s say I&#039;m building a list of songs to put on my mp3 player.&nbsp; I start with a list of all the songs from my media library, as well as a blank list that&#039;s waiting to be filled up with songs for the play list. In the past, what I&#039;ve done is create two Spry data connections to a database, one to manage the play list, and one to manage the full list of songs. </p>
<p>Of course, this is easy enough to do, but I wanted to make it a bit better.&nbsp; For example, when selecting a song, I wanted to be able to show that the song was selected (and also make it un-selectable again). &nbsp;</p>
<p>My past approach would have been to start with an onclick event to handle the data saving.&nbsp; Once this process was complete, I would have fired a complete reload of both my datasets&#8211;when they would reload, the song I added would appear in the play list and the song I selected would now be flagged with a &quot;IN_PLAYLIST&quot; tag that would instruct whatever event listeners I had set up to ignore this until it was removed from the play list.</p>
<p>So this works, but it&#039;s horribly inefficient.&nbsp; First, and most glaring, is that two full rounds to the server are made for every 1 song that is added to the playlist (or removed).&nbsp; Second, and related, is that this does not take advanatage of easy DOM manipulation of these elements that could have saved some server round trips.&nbsp; Third, it&#039;s just not very elegant, and makes the whole experience feel a bit disjointed.</p>
<p>Not satisified with this, I decided to really dig into doing this better when a similar bit of application work came around.I started by eliminating one of the server requests.&nbsp; Since I&#039;m going to do this without reloading the dataset from the database, I can load the &quot;playlist&quot; dataset without Spry and do it all on server.&nbsp; Easy enough. &nbsp;</p>
<p>So now I&#039;m down to one dataset for my &quot;current library&quot;.&nbsp; In the code, I&#039;m passing some information from my query about each song in the &quot;current library,&quot; and each song that is in the playlist is marked with a boolean in a column labeled &quot;IN_PLAYLIST&quot;.&nbsp; In my HTML, I&#039;m using a spry:if to evaluate this column, which determines what kind of image shows up next to the song (e.g., whether or not it is selectable).</p>
<p>From here, I&#039;m using some standard JS to transfer all the details of the selected song to the playlist dataset.&nbsp; Additionally, I&#039;m using JS to manipulate the &quot;selected&quot; element so that it is no longer selected AND gives an indication that it is somehow different from the rest of the &quot;current library&quot; in that it is &quot;in&quot; the playlist dataset. Again, easy enough.</p>
<p>It&#039;s at right about this time that I run smack into a huge problem.&nbsp; You see, all this time I&#039;ve been using a Spry dataset for the &quot;current library&quot; songs, but I&#039;ve also been paging these using SpryPagedView.js.&nbsp; For some reason, even after modifying the newly selected elements through JS, if I navigate between the pages of the paged view dataset, all of the changes I make (well, at least those that are related to the spry:if) are reverted to their original form (e.g., what they looked like when I initially loaded the page).&nbsp; So what&#039;s happening? &nbsp;<br />Well, first of all, I apologize if I don&#039;t get this 100% right in my explanation, but you&#039;ll see how my understanding eventually led to a solution. </p>
<p>When a paged view dataset is created, all of the initial data elements are stored in various arrays.&nbsp; When you navigate between pages, Spry evaluates each &#039;page&#039; based on a few variables (page size, page number, etc) and uses the result to go back to these arrays and populate the data shown based on these.&nbsp; Note especially that this happens every time a page in the paged view is selected.</p>
<p>This means that if you have a spry:if in your code, Spry runs over that for <strong>EVERY PAGE</strong> of the paged view, and does it <strong>EVERY TIME</strong> you navigate between pages.</p>
<p>Of course, this answers the question of what was happening to my code above.&nbsp; Even though I was modifying the HTML elements of the &quot;current library&quot; to display based on selections, Spry didn&#039;t care what I had done once I changed the &quot;page&quot; of the paged view.&nbsp; Rather, Spry re-evaluated the spry:if&#039;s, and re-rendered the element based on that.&nbsp; Whatever parts of my changes that were in conflict with the spry:if were overwritten.</p>
<p>So obviously, simply modifying the HTML element itself is not enough to achieve the desired functionality.&nbsp; </p>
<p>But never fear, for the solution is actually pretty simple. All we have to do in addition to modifying the HTML element is to also modify the array from which Spry is pulling its data each time.&nbsp; As I mentioned, this is surprising simple to do.</p>
<p>For paged datasets, Spry stores the data items in an object called &quot;unfilteredData&quot;.&nbsp; So if my paged recordset is &quot;pvRecords&quot;, the path in the DOM to the unfiltered data is simply &quot;pvRecords.unfilteredData&quot;.&nbsp; Now that I&#039;ve accessed the array, I can search through the data items in it to find the one I want and modify it to the updated value.&nbsp; Now, when </p>
<p>Spry evaluates the spry:if in the code, it uses the new value updated in the unfilteredData array, and renders correctly.</p>
<p>Here&#039;s an example of what I&#039;ve done:</p>
<p>function modifySpryDataReference(title,dir) {</p>
<p>&nbsp;&nbsp; &nbsp;var uds&nbsp;&nbsp; &nbsp;= pvRecordsAlt.unfilteredData;<br />&nbsp;&nbsp; &nbsp;for(i=0;i&lt;uds.length;i++) {<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if(uds[i].TITLE == title) {<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;uds[i].IN_PLAYLIST=dir;<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;}<br />}</p>
<p>In this example, I simply loop over the contents of the unfiltered dataset, looking for the item whose title matches the argument I pass to the function.&nbsp; If a match is found, I access the &quot;IN_PLAYLIST&quot; item and change the boolean to whichever &quot;direction&quot; I&#039;m going (e.g., whether I&#039;m adding or removing a song from the playlist). &nbsp;</p>
<p>So yeah, it&#039;s not too bad of a thing to do, and it helps to give a little better perspective/understanding on what Spry is doing under the covers <img src='http://existdissolve.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2009/05/manipulating-spry-datasets-in-the-dom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamically Loading JavaScript…with Spry!</title>
		<link>http://existdissolve.com/2008/12/dynamically-loading-javascript-with-spry/</link>
		<comments>http://existdissolve.com/2008/12/dynamically-loading-javascript-with-spry/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 17:46:43 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[Spry Framework]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Loading JavaScript]]></category>
		<category><![CDATA[Spry]]></category>

		<guid isPermaLink="false">http://existdissolvetest.wordpress.com/2008/12/23/dynamically-loading-javascript-with-spry</guid>
		<description><![CDATA[I&#039;ve written a couple of articles in the last few months about my adventures in JavaScript.&#160; While I certainly don&#039;t claim to be even proficient, I am getting better day by day.&#160; As I pick up tricks and tips, I try to pass them on to help others out (hopefully!). &#160; Recently, we ran into&#8230;]]></description>
			<content:encoded><![CDATA[<p>I&#039;ve written a couple of articles in the last few months about my adventures in JavaScript.&nbsp; While I certainly don&#039;t claim to be even proficient, I am getting better day by day.&nbsp; As I pick up tricks and tips, I try to pass them on to help others out (hopefully!). &nbsp;</p>
<p>Recently, we ran into an issue at work.&nbsp; We&#039;re constantly adding JavaScript functionality to our company intranet.&nbsp; While adding references to JavaScript files in the master pages that drive the templates is easy to do, there is a process that all master page changes have to go through, and this can limit the desirability of future changes.&nbsp; What we needed was a way to dynamically load JavaScript files when needed, so that only the core init.js file that is loaded with every page request needs to be referenced on the master pages.</p>
<p>I&#039;ve never done this kind of thing before, so I did a little snooping around.&nbsp; There are apparently alot of solutions out there, some of them better and more robust than others.&nbsp; After studying what they do, I decided to try my hand at building a simple JS loader in Spry, given that the core files I need are already in place.&nbsp; Here&#039;s the result:</p>
<pre>Spry.Utils.addLoadListener(function() { addEventHandlers() });

var wiki = &#039;wikicontent&#039;;

function addEventHandlers() {&nbsp;&nbsp;&nbsp; if (Spry.$$(wiki)) {&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; loadJS(&#039;js/showlinks.js&#039;)&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; getLinks();&nbsp;&nbsp;&nbsp; }}</pre>
<pre>function loadJS(file) {&nbsp;&nbsp;&nbsp; var syncJS = Spry.Utils.loadURL(&quot;GET&quot;,file,false,addJS);&nbsp;&nbsp;&nbsp; }</pre>
<pre>function addJS(req){&nbsp;&nbsp;&nbsp; if (window.location.href.indexOf(&quot;http&quot;)==-1 || req.xhRequest.status==200) {&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var head = document.getElementsByTagName(&#039;head&#039;)[0]; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; newJS = document.createElement(&#039;script&#039;);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; newJS.setAttribute(&#039;type&#039;, &#039;text/javascript&#039;);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; newJS.text = req.xhRequest.responseText;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; head.appendChild(newJS);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }} </pre>
<p>Turns out this is really easy.&nbsp; The first thing you&#039;ll want to do, of course, is check to see if the element/function/etc that needs special JavaScript loaded exists.&nbsp; In my example, I&#039;m checking to see if the div that wraps a wiki element exists.</p>
<p>If it does, I call the loadJS() function (yes, I know, quite original!).&nbsp; This function is really a go-between function that allows the meat of the process&#8211;the URL load&#8211;to be independant of this context and, therefore, reusable.&nbsp; It takes only one argument: the relative path to the JavaScript file that needs to be loaded.</p>
<p>This argument is then passed to an instance of the Spry.loadURL function.&nbsp; This function will make a synchronous XMLHttpRequest to the specified URL.&nbsp; Easy.</p>
<p>Now for the most important part.&nbsp; When the XMLHttpRequest returns a value, it needs to be written back to the DOM so that the functions included in the JavaScript file will be available for use.&nbsp; This is accomplished on the callback function of the loadURL(), &#039;addJS&#039;.&nbsp; This function bascially takes the returned XML response, parses it, and writes it to a new script tag, which we create.&nbsp; Finally, the new script tag is appended to the &quot;head&quot; tag of the page.</p>
<p>BIG GOTCHA:&nbsp; IE7 will not recognize &quot;innerHTML&quot; for the script tag, so you have to use &quot;text&quot;. &nbsp;</p>
<p>That&#039;s it.&nbsp; Now all functions and variable available in the requested JavaScript file are immediately available for use&#8211;in fact, this example makes a call to &quot;getLinks()&quot;, the core function of the &quot;showlinks.js&quot; file.</p>
<p>Now obviously, this is an extremely simple example, and more complicated scenarios will require more processing, more capturing of errors, etc.&nbsp; And one downside is that for this example, it require that SpryData.js, SpryDOMUtils.js, and an init.js be loaded with the page.&nbsp; This could get a bit expensive, and less elegant (IMO) methods of accomplishing the same thing can occur with a tad less overhead.&nbsp; Nonetheless, if you can spare the fractionally greater load times, it provides a simple way to make your coding even more flexible&#8230;and it uses Spry, to boot!</p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2008/12/dynamically-loading-javascript-with-spry/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flippin&#039; Cool Spry Goodness</title>
		<link>http://existdissolve.com/2008/09/flippin-cool-spry-goodness/</link>
		<comments>http://existdissolve.com/2008/09/flippin-cool-spry-goodness/#comments</comments>
		<pubDate>Mon, 01 Sep 2008 09:59:03 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[Spry Framework]]></category>
		<category><![CDATA[Flippin\' Cool]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Spry]]></category>

		<guid isPermaLink="false">http://existdissolvetest.wordpress.com/2008/09/01/flippin-cool-spry-goodness</guid>
		<description><![CDATA[As followers of this blog know, I am a pretty big fan of Adobe&#039;s JavaScript framework, Spry. Admittedly, it&#039;s not a super-huge framework like jQuery, but I like its simplicity and how rapidly I can develop a solution with it. One thing I&#039;ve been frustrated with is Spry&#039;s effects. While they have some good effects,&#8230;]]></description>
			<content:encoded><![CDATA[<p>As followers of this blog know, I am a pretty big fan of Adobe&#039;s JavaScript framework, Spry.  Admittedly, it&#039;s not a super-huge framework like jQuery, but I like its simplicity and how rapidly I can develop a solution with it.</p>
<p>One thing I&#039;ve been frustrated with is Spry&#039;s effects.  While they have some good effects, I never found them particularly flexible or usable beyond little dynamic enhacements.  Apparently, most of this is because I hadn&#039;t read the documentation enough.</p>
<p>Enter effect clustering.  Normally, Spry effects run in turn of function call: so if you have, say, a tool-tip that you want to fade out and move, these effects would run in order (which wouldn&#039;t really make sense to do anyway).  However, as I discovered with great joy yesterday, Spry allows for something called &quot;effect clustering&quot; which allows any number of effects to be run in parallel with one another.</p>
<p>I about peed my pants when I found this out, it&#039;s so cool and useful.  So <a href="code_samples/bubbles">here&#039;s an example</a> of this in action.</p>
<p>And here&#039;s the code:</p>
<pre>FadeMove = function(element, options) {    Spry.Effect.Cluster.call(this, options);

    var duration = 1000;    var toggle = &#039;false&#039;;    var from = 100;    var to = 0;    var fromPos = new Spry.Effect.Utils.Position();        fromPos.x = 13;        fromPos.y = 0;    var toPos = new Spry.Effect.Utils.Position();        toPos.x = 13;        toPos.y = -65;    Spry.Effect.makePositioned(element);

    var transition = Spry.fifthTransition;

    if (options) {        if (options.duration != null) duration = options.duration;        if (options.from != null) from = options.from;        if (options.to != null) to = options.to;        if (options.transition != null) transition = options.transition;    }

    var fadeOut = new Spry.Effect.Fade(element, {duration: 500, from: from, to: to, transition: transition, toggle: toggle});    var moveUp = new Spry.Effect.Move(element, fromPos, toPos,{duration: 800, transition: transition, toggle: toggle});

    this.addParallelEffect(fadeOut);    this.addParallelEffect(moveUp);};

FadeMove.prototype = new Spry.Effect.Cluster();FadeMove.prototype.constructor = FadeMove;</pre>
<p>Honestly, this is super-easy to do.  You start by extending the Cluster class&#8211;any effects that you include in this extension now become a cluster.</p>
<pre>FadeMove = function(element, options) {    Spry.Effect.Cluster.call(this, options);    .............}FadeMove.prototype = new Spry.Effect.Cluster();FadeMove.prototype.constructor = FadeMove;</pre>
<p>In this example, I want to have an effect that &quot;fades&quot; and &quot;moves&quot;, so I called my class extension &quot;FadeMove.&quot;  You can call it whatever you want.</p>
<p>The next thing to do is to setup some default options for the effects you&#039;re going to be using:</p>
<pre>var duration = 1000;    var toggle = &#039;false&#039;;    var from = 100;    var to = 0;    if (options) {        if (options.duration != null) duration = options.duration;        if (options.from != null) from = options.from;        if (options.to != null) to = options.to;        if (options.transition != null) transition = options.transition;    }</pre>
<p>The function allows you to pass in your own options dynamically, so these are just here as a safety net.</p>
<p>Next, define your effects, just as you normally would for any Spry effect call:</p>
<pre>var fadeOut = new Spry.Effect.Fade(element, {duration: 500, from: from, to: to, transition: transition, toggle: toggle});    var moveUp = new Spry.Effect.Move(element, fromPos, toPos,{duration: 800, transition: transition, toggle: toggle});</pre>
<p>Simple.  So now the only thing left to do is to tell the function that you&#039;d like to have these effects run in parallel.  As with all things Spry, this is cake:</p>
<pre>this.addParallelEffect(fadeOut);this.addParallelEffect(moveUp);</pre>
<p>Guess what?  That&#039;s it.  There is nothing more to it than that.  Seriously, I am completely psyched about abusing this new knowledge on all my projects.  <a href="code_samples/bubbles">Be sure to check out my example</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2008/09/flippin-cool-spry-goodness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spry&#039;s Rating Widget</title>
		<link>http://existdissolve.com/2008/04/sprys-rating-widget/</link>
		<comments>http://existdissolve.com/2008/04/sprys-rating-widget/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 22:08:34 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[Spry Framework]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Delicious]]></category>

		<guid isPermaLink="false">http://existdissolvetest.wordpress.com/2008/04/16/sprys-rating-widget</guid>
		<description><![CDATA[For a new project I&#039;m working on, I will need a mechanism for users to vote on certain pieces of content. Now it turns out that there are a billion and one ways of doing this, with an additional billion sets of frameworks. I was quite overwhelmed by the number of choices, so I&#039;ve been&#8230;]]></description>
			<content:encoded><![CDATA[<p>For a new project I&#039;m working on, I will need a mechanism for users to vote on certain pieces of content.  Now it turns out that there are a billion and one ways of doing this, with an additional billion sets of frameworks.  I was quite overwhelmed by the number of choices, so I&#039;ve been putting it off for a while now.</p>
<p>Yet fortuitously, a couple days ago I was browsing the Spry docs and noticed two very promising words:  Rating Widget.</p>
<p>Surely this cannot be what I&#039;m looking for, could it?  Ah but it was!
<p>Recently, Spry updated its growing library of widgets to include a standard &quot;star&quot; rating system.  Like it&#039;s other widgets, the rating widget comes with a single css file and a single javascript file.  And also like other Spry widgets, it is completely simple to implement.</p>
<p>Assuming you have referenced the css and javascript files correctly, here&#039;s all it takes to set up a star rating system:</p>
<pre>&lt;span id=&quot;myrating&quot; class=&quot;ratingContainer&quot;&gt;

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;span class=&quot;ratingButton&quot;&gt;&lt;/span&gt;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;span class=&quot;ratingButton&quot;&gt;&lt;/span&gt;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;span class=&quot;ratingButton&quot;&gt;&lt;/span&gt;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;span class=&quot;ratingButton&quot;&gt;&lt;/span&gt;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;span class=&quot;ratingButton&quot;&gt;&lt;/span&gt;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;input type=&quot;text&quot; id=&quot;ratingValue&quot; name=&quot;dynamic_rate&quot;/&gt;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;span class=&quot;ratingRatedMsg&quot;&gt;Thanks for voting !&lt;/span&gt;&nbsp;&nbsp;&nbsp; &lt;/span&gt; </pre>
<p>It&#039;s so simple it&#039;s almost laughable.  But it gets much better.  Like all things Spry, this widget makes it incredibly easy to connect with other files that might handle server-side processing (such as computing the new average of votes based on user&#039;s selection).  To do this, you just add an additional parameter to the widget that specifies the file that will be doing the processing, as well as any arguments that need to be sent along.  Spry takes care of the rest.  Oh, and there is also a handy parameter (&#039;afterRating&quot;) that allows you to easily update the widget with the returned value from the original request, all completely asynchronously.  And here&#039;s that:</p>
<pre>var rate = new Spry.Widget.Rating(&quot;myrating&quot;, {ratingValue:2, afterRating:&#039;serverValue&#039;, saveUrl: &quot;rating.cfc?method=returnAverage&quot;,postData:&quot;id=myrating&amp;rating=@@ratingValue@@&quot;});</pre>
<p> 
<p>Here, I simply instantiate a new widget, set a default rating &quot;average&quot; (2), specify the &#039;afterRating&#039; to get the returned serverValue, and setup my url fetch with appropriate arguments.  Absolute cake!</p>
<p>Check out an <a href="code_samples/rating_test/rating.cfm">extremely stripped down version</a> of all that the Spry rating widget is capable of doing.</p>
<p>Oh, and tomorrow I will follow up on this regarding how we move this already cool widget to full-on unobtrusiveness.</p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2008/04/sprys-rating-widget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unobtrusive JavaScript…Duh!</title>
		<link>http://existdissolve.com/2008/04/unobtrusive-javascript-duh/</link>
		<comments>http://existdissolve.com/2008/04/unobtrusive-javascript-duh/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 16:00:17 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[Spry Framework]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://existdissolvetest.wordpress.com/2008/04/15/unobtrusive-javascript-duh</guid>
		<description><![CDATA[As I develop more applications that leverage JavaScript&#8211;both for data manipulation AND for superfluous effects&#8211;the more I come to realize the inexpressible need for finding as many shortcuts as possible. Without exception, as my JavaScript becomes more involved, so the complexity increases exponentially. To remedy this, I&#039;ve started relying on frameworks such as Adobe&#039;s Spry,&#8230;]]></description>
			<content:encoded><![CDATA[<p>As I develop more applications that leverage JavaScript&#8211;both for data manipulation AND for superfluous effects&#8211;the more I come to realize the inexpressible need for finding as many shortcuts as possible.  Without exception, as my JavaScript becomes more involved, so the complexity increases exponentially.  To remedy this, I&#039;ve started relying on frameworks such as Adobe&#039;s Spry, mooTools, jQuery, etc. to make my life easier for everything from element selection to major effects processing.</p>
<p>However, probably the biggest time-saver is making a concerted effort to make my JavaScript unobtrusive.  What is this, you say?  Well, by no means does it have a solidified meaning.  However, a few principles are core to any definition.  </p>
<p>The first is the idea of abstracting the functionality of JavaScript (be it data handling or effect processing) from the design layer on which the functionality is placed.  In short, this means that the HTML markup of a site (and its corresponding CSS) should not be dependent on the functionality of JavaScript; rather, the functionality of JavaScript should be &quot;pluggable&quot; into the markup that it finds.  </p>
<p>Now of course, this is all-too-idealistic.  There is never a scenario in which markup and functionality are mutually ambivalent towards one another.  However, the premise is still sound.  Even as style (CSS) and markup (HTML) should live cohesively, yet independantly, so should JavaScript and HTML.  </p>
<p>This means, then, the end of inline JavaScript function calls.  No more &quot;&lt;img src=&#039;foo.jpg&#039; onclick=&#039;doFoo()&#039; /&gt;&#039;.  The answer?  Register an event-listener that will perform the exact same functionality, but will additionally not be render-glued to the HTML to which the action is applied.   </p>
<p>Now believe me, I&#039;ve only been doing this for just a few months and I&#039;ve quickly found that registering event-listeners and all the other fun unobtrusive novelties of JavaScript IS A LOT OF WORK!  It&#039;s simple to slap down some inline function calls, but requires more thought when registering event listeners.  Plus, you have to think about the implications of &#039;bubbling&#039;, the possibility of a need to remove these event-listeners, etc.</p>
<p>At first glance, it does not seem worth it.  More complex code, more work.  Hmm, maybe I&#039;ll pass.  But wait!  There are HUGE benefits.</p>
<p>The first (and most important in my mind) is that inevitably, unobtrusive JavaScript SAVES time.  Even though it takes more time initially to setup, the long-term benefits to an application are innumerable.  </p>
<p>Consider a scenario where you have a very simple, routine function that has inline processing on, say, 15 pages.  What happens if you need/want to change the name of that function, or any arguments that might be passed in it?  Well, you&#039;re screwed.  You&#039;ll have to run through 15 pages, making sure to make the correct modifications to the appropriate peices.  </p>
<p>With unobtrusive JavaScript, however, this problem disappears completely.  As long as the markup remains the same across those pages, a change to a function that affects those 15 HTML elements is as simple as a single change to a single file that manages the event-listeners for those elements.  Just stopping there, the argument for unobtrusive JavaScript is won.</p>
<p>However, it gets better.  </p>
<p>Some JavaScript libraries use *funky*, non-standards-compliant special tags for their inline processing.  While the JavaScript works brilliantly, W3C will pitch a fit about the non-compliant code that has been generated.  So why are these tags created in the first place?  Well, they are simple ways for the JavaScript framework to find its special elements and apply the necessary processing to them.  But with unobtrusive JavaScript, these non-compliant tags are rendered completely unnecessary.  Because elements and events are being defined in abstraction from the markup, there is no need to identify inline areas for processing.  These elements have already been identified independantly of the markup, and can therefore be processed for the JavaScript framework as if nothing has changed.</p>
<p>Without question, my brief description of the benefits of unobtrusive JavaScript hardly does justice to the promise that it holds for seriously robust development, and I have not even mentioned the way in which it aids the development of accessible content.  Nonetheless, I am very excited about what can be done with it, and hope that this is an inspriing discussion to other designers who are looking for better and more efficient ways to create richer experiences on the web.</p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2008/04/unobtrusive-javascript-duh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adobe&#039;s Spry Framework, Part Second</title>
		<link>http://existdissolve.com/2008/03/adobes-spry-framework-part-second-2/</link>
		<comments>http://existdissolve.com/2008/03/adobes-spry-framework-part-second-2/#comments</comments>
		<pubDate>Mon, 24 Mar 2008 04:11:21 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[Spry Framework]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Web 2.0]]></category>

		<guid isPermaLink="false">http://existdissolvetest.wordpress.com/2008/03/24/adobes-spry-framework-part-second-2</guid>
		<description><![CDATA[A couple days ago, I posted an example of how Adobe&#039;s Spry Framework allows one to easily and quickly incorporate XML datasets into an application, allowing for a great alternative to page-to-page navigation and data mining. One of the limitations I pointed out was the initial amount of coding involved. Well, that was because I&#039;m&#8230;]]></description>
			<content:encoded><![CDATA[<p>A couple days ago, I posted an <a href="http://existdissolve.com/code_examples/spryTest1/showlocations.cfm">example</a> of how Adobe&#039;s Spry Framework allows one to easily and quickly incorporate XML datasets into an application, allowing for a great alternative to page-to-page navigation and data mining.</p>
<p>One of the limitations I pointed out was the initial amount of coding involved. Well, that was because I&#039;m an idiot.</p>
<p>While I&#039;ve used Spry&#039;s Spry.Data.XMLDataSet() many times before, I literally had no idea how powerful it is, nor that it could interact with dynamically generated XML files, such as I was doing with ColdFusion components in my last example. However, such is not the case. Not only does this method allow me to do everything I was doing before, it involves a heck of lot less code. The entire invoke for the datasets here is:</p>
<p>&nbsp;</p>
<pre>var dsCities = new Spry.Data.XMLDataSet(&quot;getlocations.cfc method=getCities&quot;, &quot;cities/city&quot;);

var dsLocations = new Spry.Data.XMLDataSet(&quot;getlocations.cfc?method=getLocations&amp;cityID={dsCities::@id}&quot;, &quot;locations/location&quot;);</pre>
<p>&nbsp;</p>
<p>Two lines of javascript! Now of course, there is more to handle some of the behaviors&#8230;but I have effectively cut out about 100 lines from what I was doing before. Pretty cool!</p>
<p>Finally, the best part about this is it allows me to take full advantage of the framework&#039;s &quot;spry:state&quot;. With this, one can set different &quot;states&quot; that will fire in relation to the loading of the datasets. So, while the data is loading, one can display a sexy progress gif using &quot;spry:state=loading&quot;. And when the dataset is retrieved, one can use &quot;spry:state=ready&quot; to display the returned datasets.</p>
<p>Oh yeah, one LAST thing. Using datasets like this makes dynamic callbacks a breeze. Imagine I have items that a user can save to their &quot;favorites&quot;. Using the &quot;spry:if&quot;, I can tell the browser to display certain elements certain ways depending on the recordsets that are returned (i.e., whether or not the user has a particular item saved to their favorites). Before Spry, I would have the user &quot;save&quot; the favorite which would reload the page, re-hit the database, and alter the display to show the changes to the data. With Spry, however, the page reload is no longer necessary. Rather, one can simply tell the callback function from the insert query to recompile the Spry dataset asychronously. Because the data that&#039;s currently being display is based on this dataset, the returned information will be refreshed automatically, all without the need of a single page reload.</p>
<p>Blah, blah, blah. Enough of this. <a href="http://existdissolve.com/code_examples/spryTest2/showlocations.cfm">Here&#039;s a slightly more sexy example</a> of what I&#039;ve been talking about.</p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2008/03/adobes-spry-framework-part-second-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Web 2.0 Goodness &#8211; Adobe&#039;s Spry Framework</title>
		<link>http://existdissolve.com/2008/03/web-2-0-goodness-adobes-spry-framework-2/</link>
		<comments>http://existdissolve.com/2008/03/web-2-0-goodness-adobes-spry-framework-2/#comments</comments>
		<pubDate>Mon, 24 Mar 2008 03:48:42 +0000</pubDate>
		<dc:creator>existdissolve</dc:creator>
				<category><![CDATA[Spry Framework]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Spry]]></category>
		<category><![CDATA[Web 2.0]]></category>

		<guid isPermaLink="false">http://existdissolvetest.wordpress.com/2008/03/24/web-2-0-goodness-adobes-spry-framework-2</guid>
		<description><![CDATA[Ok, so as everyone who reads this blog knows (or should know&#8230;), I am a web designer/web developer. On the development side, I am best at ColdFusion , one of the under-appreciated programming langugages out there. While ColdFusion is awesome, one of the drawbacks of it (as well as of PHP, .NET, etc.) is that&#8230;]]></description>
			<content:encoded><![CDATA[<p>Ok, so as everyone who reads this blog knows (or should know&#8230;), I am a web designer/web developer. On the development side, I am best at <a href="http://www.adobe.com/products/coldfusion/">ColdFusion</a> , one of the under-appreciated programming langugages out there. While ColdFusion is awesome, one of the drawbacks of it (as well as of PHP, .NET, etc.) is that it is a server-side technology, meaning (surprise, surprise) that all of the code processing done is accomplished on the server. So, any of the cool Web 2.0 stuff out there, like asynchronous form submission, has to use Javascript. </p>
<p>While ColdFusion 8 has some seriously cool AJAX features built into it that handle alot of this kind of thing with ease, it is not free and wonderful hosting companies (like GoDaddy) are slow to upgrade their servers to the newest version. Therefore, the onus is upon the developer to utilize the various work-arounds until ColdFusion 8 is firmly entrenched.</p>
<p>One tool that makes life significantly easier is Adobe&#039;s <a href="http://labs.adobe.com/technologies/spry/">Spry Framework</a> . While Spry includes a lot of the cool effects of other Javascript frameworks, one of the best parts of it is the easy way in which it allows Spry to make server-side calls to allow applications to harness normally off-limits server-side functionality asychronously. For example, consider that I wish to display a list of businesses by city. I want to be able to display the businesses by city, as well as all without a filter on the city. To accomplish this without Javascript and ColdFusion alone, the standard practice would be to give each city link an ID that would be passed to the URL string. Then, when the page reloads, the variable passed to the URL string would tell the database to only show the records that are relevant to that variable.</p>
<p>While this works, it is not very sexy. It requires page reload after page reload just to see different information. Blah. Enter Spry. With Spry, the functionality works exactly the same. A variable is passed through a URL that tells the database to only return certain records. However, what is different is that Spry does not need page reloads. Rather, being the sexy little thing that it is, Spry is able to pass the variable to ColdFusion, get ColdFusion to process the variable on the server, return the variable to Spry, and then output it for the user to see&#8212;all without a single page reload.</p>
<p>While this is a great solution for the end user, it does require a bit more effort on the development side. With ColdFusion, I could normally do the database call, data processing, and data ouput in about 20 lines of code. Using Spry, however, has significantly increased that number, for besides having to outline&#8211;in Javascript&#8211;the various xhtml elements that I wish to populate with data, I also have convert my database queries to an XML format that Spry will be content to use. </p>
<p>Nonetheless, I think the number of lines of code is justifiable, and as I do this more, the coding time will be signficantly reduced. Plus, I think the end result is pretty dang cool.</p>
<p>Interested? You can see a very unsexy example <a href="http://existdissolve.com/code_examples/spryTest1/showlocations.cfm">here</a> .</p>
]]></content:encoded>
			<wfw:commentRss>http://existdissolve.com/2008/03/web-2-0-goodness-adobes-spry-framework-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

