<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Pure-Essence.Net &#187; date picker</title>
	<atom:link href="http://pure-essence.net/tag/date-picker/feed/" rel="self" type="application/rss+xml" />
	<link>http://pure-essence.net</link>
	<description>You have to visit this geeky girl&#039;s blog.</description>
	<lastBuildDate>Wed, 23 May 2012 01:27:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='pure-essence.net' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Pure-Essence.Net &#187; date picker</title>
		<link>http://pure-essence.net</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://pure-essence.net/osd.xml" title="Pure-Essence.Net" />
	<atom:link rel='hub' href='http://pure-essence.net/?pushpress=hub'/>
		<item>
		<title>Why I prefer jQuery over YUI</title>
		<link>http://pure-essence.net/2008/10/11/why-i-prefer-jquery-over-yui/</link>
		<comments>http://pure-essence.net/2008/10/11/why-i-prefer-jquery-over-yui/#comments</comments>
		<pubDate>Sat, 11 Oct 2008 14:16:26 +0000</pubDate>
		<dc:creator>pureessence</dc:creator>
				<category><![CDATA[geeky]]></category>
		<category><![CDATA[non php code]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[component]]></category>
		<category><![CDATA[datatable]]></category>
		<category><![CDATA[date picker]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[paginator]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[widget]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://regretless.com/?p=1327</guid>
		<description><![CDATA[While at work, I was trying to find a way to easily do server side pagination without writing all the lovely logic myself. Due to some constraints, I am unable to use more high end framework such as JSF and struts. Which in a way I believe is a good thing. I would have more [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=1327&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>While at work, I was trying to find a way to easily do server side pagination without writing all the lovely logic myself. Due to some constraints, I am unable to use more high end framework such as JSF and struts. Which in a way I believe is a good thing. I would have more control over just writing servlets. However, having written pagination logic before, I really did not want to write that again. Somehow I thought of jQuery. Just for amusement, I looked for <a href="http://jquery.com/">jQuery</a> pagination plugin and guess what <a href="http://plugins.jquery.com/project/pagination">I found it</a>! By using this plugin, I can pass in some simple parameters such as total records, records per page, number of pages shown etc. to have jQuery generate a paginator for me. That&#8217;s beyond cool so I put it into action.</p>
<p><a href="http://regretless.com/work/eAdjusterActivityReport/uploadReport.php">Upload Report Mock</a> uses the jQuery pagination plugin but handles the pagination on the server side via php.</p>
<p>Ultimately what I also want to handle is the following scenario:</p>
<ul>
<li> I have a table of data, one of the column is editable.</li>
<li> If the user clicks on the column of a particular table row, a modal window will pop up asking for additional information.</li>
<li> The user fills out the information and submits.</li>
<li> The window updates the info for that table via AJAX and updates the results screen</li>
</ul>
<p>While I was eager for figure out how to accomplish that in jQuery, I found out that it is not one of the previously used javascript framework at work so they asked if I could look into <a href="http://developer.yahoo.com/yui/">YUI</a>.</p>
<p>Digging into YUI, first I tried to accomplish the same thing using the <a href="http://developer.yahoo.com/yui/paginator/">YUI paginator widget</a>. I spent two hours but it really does not seem like I can generate some href tags with this component like I could with the jQuery plugin. With jQuery, I could produce:<br />
<pre class="brush: xml; wrap-lines: false;">
&lt;div id=&quot;pagination&quot;&gt;
&lt;a class=&quot;prev&quot; href=&quot;/work/eAdjusterActivityReport/uploadReport.php?page=1&quot;&gt;Prev&lt;/a&gt;
&lt;a href=&quot;/work/eAdjusterActivityReport/uploadReport.php?page=1&quot;&gt;1&lt;/a&gt;
&lt;span class=&quot;current&quot;&gt;2&lt;/span&gt;
&lt;a href=&quot;/work/eAdjusterActivityReport/uploadReport.php?page=3&quot;&gt;3&lt;/a&gt;
&lt;a href=&quot;/work/eAdjusterActivityReport/uploadReport.php?page=4&quot;&gt;4&lt;/a&gt;
&lt;a href=&quot;/work/eAdjusterActivityReport/uploadReport.php?page=5&quot;&gt;5&lt;/a&gt;
&lt;a href=&quot;/work/eAdjusterActivityReport/uploadReport.php?page=6&quot;&gt;6&lt;/a&gt;
&lt;a href=&quot;/work/eAdjusterActivityReport/uploadReport.php?page=7&quot;&gt;7&lt;/a&gt;
&lt;a href=&quot;/work/eAdjusterActivityReport/uploadReport.php?page=8&quot;&gt;8&lt;/a&gt;
&lt;span&gt;...&lt;/span&gt;
&lt;a href=&quot;/work/eAdjusterActivityReport/uploadReport.php?page=10&quot;&gt;10&lt;/a&gt;
&lt;a href=&quot;/work/eAdjusterActivityReport/uploadReport.php?page=11&quot;&gt;11&lt;/a&gt;
&lt;a class=&quot;next&quot; href=&quot;/work/eAdjusterActivityReport/uploadReport.php?page=3&quot;&gt;Next&lt;/a&gt;
&lt;/div&gt;
</pre><br />
With YUI, I have to hook up the paginator with another javascript or YUI widget. So to make things easier, I looked into <a href="http://developer.yahoo.com/yui/datatable/">YUI&#8217;s datatable component</a> and found <a href="http://developer.yahoo.com/yui/examples/datatable/dt_dynamicdata.html">an example to use it with server side pagination and sorting</a>. That seems to accomplish the overall need of pagination. Although that&#8217;s a bit of overkill but I thought it&#8217;s worth a shot. I spent 8 hours implementing it via server side JSON. Here&#8217;s what I produced:<br />
<a href="http://regretless.com/work/eAdjusterActivityReport/uploadReportYUI.php">Upload Report Mock with YUI</a></p>
<p>Instead of 10 lines of javascript code <a href="http://regretless.com/work/eAdjusterActivityReport/uploadReport.php">like the previous</a>, this one has 68 lines. But it does provide AJAX pagination so I thought that&#8217;s mostly fair.</p>
<p>Next I looked for a simple date picker calendar in YUI like <a href="http://marcgrabanski.com/pages/code/jquery-ui-datepicker">the jQuery date picker plugin</a>. The date picker is a necessary functionality of the application. With jQuery, it&#8217;s extremely easy to use. You add the plugin js &amp; css links, and then you give your input css class or unique IDs and with jQuery selector, just call the plugin via:<br />
<pre class="brush: jscript; wrap-lines: false;">
$(&quot;#startDate&quot;).datepicker()
</pre></p>
<p>Click on the start and end dates in <a href="http://regretless.com/work/eAdjusterActivityReport/uploadReport.php">Upload Report Mock</a> to see it in action.</p>
<p>Using YUI, I looked into its calendar component.  The closest thing I could find is <a href="http://developer.yahoo.com/yui/examples/calendar/calcontainer.html">this example</a>.</p>
<p>Not only would it need all these extra js includes<br />
<pre class="brush: xml; wrap-lines: false;">
&lt;script type=&quot;text/javascript&quot; src=&quot;http://yui.yahooapis.com/2.6.0/build/event/event-min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://yui.yahooapis.com/2.6.0/build/dragdrop/dragdrop-min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://yui.yahooapis.com/2.6.0/build/element/element-beta-min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://yui.yahooapis.com/2.6.0/build/button/button-min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://yui.yahooapis.com/2.6.0/build/container/container-min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://yui.yahooapis.com/2.6.0/build/calendar/calendar-min.js&quot;&gt;&lt;/script&gt;
</pre><br />
It also requires another <a href="http://regretless.com/work/eAdjusterActivityReport/YUICalendarCode.txt">76 lines of javascript code</a> for just adding one date picker.</p>
<p>Despite the complication, I tried to make it work with <a href="http://regretless.com/work/eAdjusterActivityReport/uploadReportYUI.php">my Upload Report Mock with YUI</a> but I failed pretty miserably. Sure if I put in enough hours, I will eventually make it work but WHY? Why would you stop yourself from using something else that takes 2 seconds?</p>
<p>At this point, I presented my findings to my co-workers. I really hope they will accept jQuery. Yea sure it&#8217;s yet another new javascript framework but it will save coding time.</p>
<p>Here&#8217;s another comparison. I found a very <a href="http://www.webplicity.net/flexigrid/">YUI datatable like jQuery plugin flexigrid</a>. Take a look at example 3. Lines of code to use server side pagination and sorting: 33.  In <a href="http://regretless.com/work/eAdjusterActivityReport/uploadReportYUI.php">my Upload Report Mock with YUI</a>, <a href="http://regretless.com/work/eAdjusterActivityReport/YUIDataTableCode.txt">I used 68 lines</a>. Also let&#8217;s do a comparison to see which one makes more sense and is less verbose.</p>
<p>jQuery:<br />
<pre class="brush: jscript; wrap-lines: false;">
$(&quot;#flex1&quot;).flexigrid({
	url: 'post2.php',
	dataType: 'json',
	colModel : [
		{display: 'ISO', name : 'iso', width : 40, sortable : true, align: 'center'},
		{display: 'Name', name : 'name', width : 180, sortable : true, align: 'left'},
		{display: 'Printable Name', name : 'printable_name', width : 120, sortable : true, align: 'left'},
		{display: 'ISO3', name : 'iso3', width : 130, sortable : true, align: 'left', hide: true},
		{display: 'Number Code', name : 'numcode', width : 80, sortable : true, align: 'right'}
		],
	buttons : [
		{name: 'Add', bclass: 'add', onpress : test},
		{name: 'Delete', bclass: 'delete', onpress : test},
		{separator: true}
		],
	searchitems : [
		{display: 'ISO', name : 'iso'},
		{display: 'Name', name : 'name', isdefault: true}
		],
	sortname: &quot;iso&quot;,
	sortorder: &quot;asc&quot;,
	usepager: true,
	title: 'Countries',
	useRp: true,
	rp: 15,
	showTableToggleBtn: true,
	width: 700,
	height: 200
	}
);  
</pre></p>
<p>YUI: <a href="http://regretless.com/work/eAdjusterActivityReport/YUIDataTableCode.txt">click for source</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pe20110517.wordpress.com/1327/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pe20110517.wordpress.com/1327/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pe20110517.wordpress.com/1327/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pe20110517.wordpress.com/1327/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pe20110517.wordpress.com/1327/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pe20110517.wordpress.com/1327/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pe20110517.wordpress.com/1327/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pe20110517.wordpress.com/1327/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pe20110517.wordpress.com/1327/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pe20110517.wordpress.com/1327/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pe20110517.wordpress.com/1327/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pe20110517.wordpress.com/1327/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pe20110517.wordpress.com/1327/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pe20110517.wordpress.com/1327/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pure-essence.net&#038;blog=23194870&#038;post=1327&#038;subd=pe20110517&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pure-essence.net/2008/10/11/why-i-prefer-jquery-over-yui/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fcfd5e14ca9c91790e95dfdb1d2ad756?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">pureessence</media:title>
		</media:content>
	</item>
	</channel>
</rss>
