<?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>Ultimate Science Team &#187; dojo</title>
	<atom:link href="http://www.ultimatescienceteam.com/tag/dojo/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ultimatescienceteam.com</link>
	<description>Because fuck you, that&#039;s why.</description>
	<lastBuildDate>Sat, 24 Apr 2010 04:28:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Dojo: Simple code to dynamically generate widgets and add them to an element</title>
		<link>http://www.ultimatescienceteam.com/2009/06/28/dojo-simple-code-to-dynamically-generate-widgets-and-add-them-to-an-element/</link>
		<comments>http://www.ultimatescienceteam.com/2009/06/28/dojo-simple-code-to-dynamically-generate-widgets-and-add-them-to-an-element/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 08:21:49 +0000</pubDate>
		<dc:creator>Schrodinger</dc:creator>
				<category><![CDATA[dojo]]></category>
		<category><![CDATA[dom]]></category>
		<category><![CDATA[generating widgets]]></category>
		<category><![CDATA[insert widgets]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[widget]]></category>

		<guid isPermaLink="false">http://www.ultimatescienceteam.com/?p=642</guid>
		<description><![CDATA[Following on from the last post, this post is about the Dojo JavaScript framework, sorry guys.
Another snippet of code that might help you dynamically generate multiple widgets (hopefully from widgets that you've created) based on feeds or array data or pretty much anything.
It was an absolute nightmare to track down how to do this on [...]]]></description>
			<content:encoded><![CDATA[<p>Following on from the last post, this post is about the Dojo JavaScript framework, sorry guys.</p>
<p>Another snippet of code that might help you dynamically generate multiple widgets (hopefully from widgets that you've created) based on feeds or array data or pretty much anything.</p>
<p>It was an absolute nightmare to track down how to do this on the Dojo documentation (Dojo has such terrible documentation, they should spend some time working on it, which is why I'm posting sections that people should find helpful)</p>
<p>If you have a dom element and you're trying to append a series of n nodes to the dom element, that are all generated from material within a greater array of objects:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">myArray</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#123;</span>objtype1<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>objtype2<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>objtype3<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">//For example if you are creating widgets called 'myWidget', to which you pass the arrayValue</span>
&nbsp;
dojo.<span style="color: #660066;">forEach</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">myArray</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>arrayObject<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #006600; font-style: italic;">//In this example I'm populating list elements into a UL with the id 'ulHead'</span>
node <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
dojo.<span style="color: #660066;">byId</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ulHead'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>node<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">//Remember to use the correct widget syntax when declaring</span>
<span style="color: #003366; font-weight: bold;">var</span> widget <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> myWidget<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>widgetObject<span style="color: #339933;">:</span>arrayObject<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>node<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>I've just cross-coded that to a generic example from the actual one I'm using and have substituted a forEach in this section for the for loop I'm currently using, but this should help you on the right track if you're finding the dojo documentation a bit lacking.</p>
<p>LOOK FORWARD TO MORE OF THESE EXCITING PROGRAMMING BLOG POSTS AS TIME WEARS ON.</p>
<img src="http://www.ultimatescienceteam.com/?ak_action=api_record_view&id=642&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ultimatescienceteam.com/2009/06/28/dojo-simple-code-to-dynamically-generate-widgets-and-add-them-to-an-element/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Help for Dojo JavaScript framework users</title>
		<link>http://www.ultimatescienceteam.com/2009/06/28/help-for-dojo-javascript-framework-users/</link>
		<comments>http://www.ultimatescienceteam.com/2009/06/28/help-for-dojo-javascript-framework-users/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 07:53:26 +0000</pubDate>
		<dc:creator>Schrodinger</dc:creator>
				<category><![CDATA[dojo]]></category>
		<category><![CDATA[dojo javascript]]></category>
		<category><![CDATA[dojox]]></category>
		<category><![CDATA[dom]]></category>
		<category><![CDATA[render error]]></category>

		<guid isPermaLink="false">http://www.ultimatescienceteam.com/?p=638</guid>
		<description><![CDATA[If you're getting an error along the lines of:
Error: You cannot use the Render object without specifying where you want to render it' when calling method

You need to fix the declaration in the widget you're creating, as you've missed something really simple.
Copy the constructor from a pre-existing widget to make sure you haven't missed anything.
Also, [...]]]></description>
			<content:encoded><![CDATA[<p>If you're getting an error along the lines of:</p>
<pre style="padding-left: 30px;"><span class="objectBox objectBox-errorMessage opened">Error: You cannot use the Render object without specifying where you want to render it' when calling method</span></pre>
<p style="padding-left: 30px;">
<p>You need to fix the declaration in the widget you're creating, as you've missed something really simple.</p>
<p>Copy the constructor from a pre-existing widget to make sure you haven't missed anything.</p>
<p>Also, make sure you're specifying a valid ID within the DOM.</p>
<p>This just cost me an hour of my day, so I hope this saves you some time.</p>
<img src="http://www.ultimatescienceteam.com/?ak_action=api_record_view&id=638&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ultimatescienceteam.com/2009/06/28/help-for-dojo-javascript-framework-users/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
