<?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: Mojo Lists: Using the Depot as a Data source (Part 4)</title>
	<atom:link href="http://www.webosboston.org/2009/10/11/mojo-lists-using-the-depot-as-a-data-source-part-4/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webosboston.org/2009/10/11/mojo-lists-using-the-depot-as-a-data-source-part-4/</link>
	<description>Developing for WebOS</description>
	<lastBuildDate>Thu, 07 Jan 2010 19:32:55 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: bnduati</title>
		<link>http://www.webosboston.org/2009/10/11/mojo-lists-using-the-depot-as-a-data-source-part-4/comment-page-1/#comment-184</link>
		<dc:creator>bnduati</dc:creator>
		<pubDate>Thu, 07 Jan 2010 19:32:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.webosboston.org/?p=238#comment-184</guid>
		<description>major flaw in your logic
Transactions with the Depot object are asynchronous!! Thus the list contents are not  guaranteed to be available at Depot Scene Launch (Setup and/or Activate)

Solution:
make use of sendToNoficationChain() method to notify Depot assistant once the ajax call is complete.
The Depot assistant via the considerForNotification() method will then call modelChanged() method to update the scene
***************************************************
WBDepot.prototype.loadDepotContents = function(result){
    if(result === null){
        Mojo.Log.warn(&quot;Retrieved empty or null contents from the depot, using defaults&quot;);
        this.loadDefaultContents();
    }
    else
    {
        Mojo.Log.info(&quot;Retrieved contents from the depot&quot;);
        this.contents = result;
    }
    //Notify the chain that depot has completed retrieving contents
    Mojo.Controller.getAppController().sendToNotificationChain({
        type: &quot;depot&quot;
    });
}

**********************************************************
/**
 * Since depot transactions are asynchronous we need
 * to set up an observer to listen to notifications of successful
 * completion of ajax call
 * update our model
 */
DepotAssistant.prototype.considerForNotification = function(params)
{
    if(params &amp;&amp; params.type == &#039;depot&#039;)
    {
        this.listModel.items = this.model.getListContents();
        this.controller.modelChanged(this.listModel);
    }
}</description>
		<content:encoded><![CDATA[<p>major flaw in your logic<br />
Transactions with the Depot object are asynchronous!! Thus the list contents are not  guaranteed to be available at Depot Scene Launch (Setup and/or Activate)</p>
<p>Solution:<br />
make use of sendToNoficationChain() method to notify Depot assistant once the ajax call is complete.<br />
The Depot assistant via the considerForNotification() method will then call modelChanged() method to update the scene<br />
***************************************************<br />
WBDepot.prototype.loadDepotContents = function(result){<br />
    if(result === null){<br />
        Mojo.Log.warn(&#8220;Retrieved empty or null contents from the depot, using defaults&#8221;);<br />
        this.loadDefaultContents();<br />
    }<br />
    else<br />
    {<br />
        Mojo.Log.info(&#8220;Retrieved contents from the depot&#8221;);<br />
        this.contents = result;<br />
    }<br />
    //Notify the chain that depot has completed retrieving contents<br />
    Mojo.Controller.getAppController().sendToNotificationChain({<br />
        type: &#8220;depot&#8221;<br />
    });<br />
}</p>
<p>**********************************************************<br />
/**<br />
 * Since depot transactions are asynchronous we need<br />
 * to set up an observer to listen to notifications of successful<br />
 * completion of ajax call<br />
 * update our model<br />
 */<br />
DepotAssistant.prototype.considerForNotification = function(params)<br />
{<br />
    if(params &amp;&amp; params.type == &#8216;depot&#8217;)<br />
    {<br />
        this.listModel.items = this.model.getListContents();<br />
        this.controller.modelChanged(this.listModel);<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joseph Crawford</title>
		<link>http://www.webosboston.org/2009/10/11/mojo-lists-using-the-depot-as-a-data-source-part-4/comment-page-1/#comment-96</link>
		<dc:creator>Joseph Crawford</dc:creator>
		<pubDate>Thu, 22 Oct 2009 13:05:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.webosboston.org/?p=238#comment-96</guid>
		<description>Unfortunately it is going to be a little while before I will be able to find the time to complete Part 5 of the tutorial series.  I have just started a new job in Boston and I need to make this my primary focus for a little while so that I get up to speed on how their infrastructure works etc.

I promise that I will not forget about Part 5 and I will get to it just as soon as I can.

Thanks for the feedback!</description>
		<content:encoded><![CDATA[<p>Unfortunately it is going to be a little while before I will be able to find the time to complete Part 5 of the tutorial series.  I have just started a new job in Boston and I need to make this my primary focus for a little while so that I get up to speed on how their infrastructure works etc.</p>
<p>I promise that I will not forget about Part 5 and I will get to it just as soon as I can.</p>
<p>Thanks for the feedback!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WebOS Tech</title>
		<link>http://www.webosboston.org/2009/10/11/mojo-lists-using-the-depot-as-a-data-source-part-4/comment-page-1/#comment-95</link>
		<dc:creator>WebOS Tech</dc:creator>
		<pubDate>Thu, 22 Oct 2009 13:02:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.webosboston.org/?p=238#comment-95</guid>
		<description>Hi Joseph,

It was really a good tutorial. Waiting for SQLite version tutorial.</description>
		<content:encoded><![CDATA[<p>Hi Joseph,</p>
<p>It was really a good tutorial. Waiting for SQLite version tutorial.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Great List widget tutorial - PreCentral Forums</title>
		<link>http://www.webosboston.org/2009/10/11/mojo-lists-using-the-depot-as-a-data-source-part-4/comment-page-1/#comment-89</link>
		<dc:creator>Great List widget tutorial - PreCentral Forums</dc:creator>
		<pubDate>Sun, 11 Oct 2009 22:41:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.webosboston.org/?p=238#comment-89</guid>
		<description>[...] Part 4 was actually just posted as well. I had all the code in place as I did it while I was restructuring the code for Part 3 so I whipped that out as well. There is only one more part to this series and that is using SqLite as the data source and then I will look into the filter list stuff. However don&#039;t expect part 5 to be completed anytime too soon I still have to learn the SqLite stuff [...]</description>
		<content:encoded><![CDATA[<p>[...] Part 4 was actually just posted as well. I had all the code in place as I did it while I was restructuring the code for Part 3 so I whipped that out as well. There is only one more part to this series and that is using SqLite as the data source and then I will look into the filter list stuff. However don&#39;t expect part 5 to be completed anytime too soon I still have to learn the SqLite stuff [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.450 seconds -->
