<?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: &#9733; YUI Components with DWR &#8211; DWR DataSource</title>
	<atom:link href="http://blog.javachap.com/index.php/yui-components-with-dwr-dwrdatasource/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.javachap.com/index.php/yui-components-with-dwr-dwrdatasource/</link>
	<description>Java and Technology musings for the masses</description>
	<lastBuildDate>Mon, 23 Jan 2012 09:29:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: DLo</title>
		<link>http://blog.javachap.com/index.php/yui-components-with-dwr-dwrdatasource/comment-page-1/#comment-887</link>
		<dc:creator>DLo</dc:creator>
		<pubDate>Tue, 12 Jan 2010 22:03:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.javachap.com/?p=23#comment-887</guid>
		<description>Excellent YUI extension!  Works fine on YUI 2.8.0.

I have an addition for you, though...

This implementation requires that your exposed DWR interface have exactly 1 parameter.  If you&#039;re using your DataSource for an AutoComplete, that&#039;s a reasonable assumption.  However, for something like a DataTable, you could conceivably have a no-parameter DWR interface that just spits out a JSON array.  In this case, you&#039;re basically calling: 
dwrServiceMethod(null, dwrCallMetaData). 

DWR gets confused by this.  Because your exposed Java method is a zero-argument method, DWR expects to find its metadata in the first arguments in its generated javascript function.  However, the first argument is null because of the way you&#039;re calling it! The result is DWR can&#039;t find a callback to call, nothing happens, and your DWRDataSource just sits there idly twidling its thumbs after the makeConnection call because DWR never calls it back.  To fix this, replace lines 121-123 with something like: 

// Get ready to send the request URL
        var dwrServiceMethod = this.liveData;
        
        // If we never specified a request, call the no-parameter version of the exposed DWR interface.
        // Otherwise, assume the exposed DWR interface takes 1 parameter and pass it our request object.
        if (oRequest == null) {
          dwrServiceMethod.call(this, _dwrCallMetaData);
        } else {
          dwrServiceMethod.call(this, oRequest, _dwrCallMetaData);
        }


Even more complicated, if you want to create a DWRDataSource that supports multiple-argument DWR interfaces, you could put your multiple arguments into your oRequest object and add code that unpacks your oRequest variable into multiple arguments in your dwrServiceMethod.call(...) line.  The implementation of this is left as an exercise for the reader  : )

Thank you for this code snippet!</description>
		<content:encoded><![CDATA[<p>Excellent YUI extension!  Works fine on YUI 2.8.0.</p>
<p>I have an addition for you, though&#8230;</p>
<p>This implementation requires that your exposed DWR interface have exactly 1 parameter.  If you&#8217;re using your DataSource for an AutoComplete, that&#8217;s a reasonable assumption.  However, for something like a DataTable, you could conceivably have a no-parameter DWR interface that just spits out a JSON array.  In this case, you&#8217;re basically calling:<br />
dwrServiceMethod(null, dwrCallMetaData). </p>
<p>DWR gets confused by this.  Because your exposed Java method is a zero-argument method, DWR expects to find its metadata in the first arguments in its generated javascript function.  However, the first argument is null because of the way you&#8217;re calling it! The result is DWR can&#8217;t find a callback to call, nothing happens, and your DWRDataSource just sits there idly twidling its thumbs after the makeConnection call because DWR never calls it back.  To fix this, replace lines 121-123 with something like: </p>
<p>// Get ready to send the request URL<br />
        var dwrServiceMethod = this.liveData;</p>
<p>        // If we never specified a request, call the no-parameter version of the exposed DWR interface.<br />
        // Otherwise, assume the exposed DWR interface takes 1 parameter and pass it our request object.<br />
        if (oRequest == null) {<br />
          dwrServiceMethod.call(this, _dwrCallMetaData);<br />
        } else {<br />
          dwrServiceMethod.call(this, oRequest, _dwrCallMetaData);<br />
        }</p>
<p>Even more complicated, if you want to create a DWRDataSource that supports multiple-argument DWR interfaces, you could put your multiple arguments into your oRequest object and add code that unpacks your oRequest variable into multiple arguments in your dwrServiceMethod.call(&#8230;) line.  The implementation of this is left as an exercise for the reader  : )</p>
<p>Thank you for this code snippet!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: In the Wild for July 17, 2009 &#187; Yahoo! User Interface Blog</title>
		<link>http://blog.javachap.com/index.php/yui-components-with-dwr-dwrdatasource/comment-page-1/#comment-295</link>
		<dc:creator>In the Wild for July 17, 2009 &#187; Yahoo! User Interface Blog</dc:creator>
		<pubDate>Fri, 17 Jul 2009 18:06:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.javachap.com/?p=23#comment-295</guid>
		<description>[...] YUI Components with DWR — DWRDataSource: Vijay Dendukuri writes on his JavaChap blog: &#8220;I’m working on project which uses YUI and DWR. The hardest part is intergrating these two. I googled on how people integrated YUI and DWR, found&#160;this&#160;and&#160;this. But these solutions will only work with earlier versions of YUI. I’m using YUI 2.7. So i ended up writing my own DWRDataSource. Might be useful for guys who want to integrate DWR and YUI 2.7.&#8221; (Original source.) [...]</description>
		<content:encoded><![CDATA[<p>[...] YUI Components with DWR — DWRDataSource: Vijay Dendukuri writes on his JavaChap blog: &#8220;I’m working on project which uses YUI and DWR. The hardest part is intergrating these two. I googled on how people integrated YUI and DWR, found&nbsp;this&nbsp;and&nbsp;this. But these solutions will only work with earlier versions of YUI. I’m using YUI 2.7. So i ended up writing my own DWRDataSource. Might be useful for guys who want to integrate DWR and YUI 2.7.&#8221; (Original source.) [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

