<?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: Revisiting the JavaScript Calendar Control &#8211; Part 3</title>
	<atom:link href="http://karlagius.com/2009/11/25/revisiting-the-javascript-calendar-control-part-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://karlagius.com/2009/11/25/revisiting-the-javascript-calendar-control-part-3/</link>
	<description>It&#039;s not rocket science</description>
	<lastBuildDate>Sun, 06 May 2012 06:53:58 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Karl</title>
		<link>http://karlagius.com/2009/11/25/revisiting-the-javascript-calendar-control-part-3/comment-page-1/#comment-1525</link>
		<dc:creator>Karl</dc:creator>
		<pubDate>Thu, 03 May 2012 11:19:13 +0000</pubDate>
		<guid isPermaLink="false">http://karlagius.com/?p=354#comment-1525</guid>
		<description>Of course I&#039;ll help if you have any questions. However, I would recommend that you try to use this instead: http://jqueryui.com/demos/datepicker/

You&#039;ll find a lot more support for jQuery UI, and there are a lot more widgets to play with :)</description>
		<content:encoded><![CDATA[<p>Of course I&#8217;ll help if you have any questions. However, I would recommend that you try to use this instead: <a href="http://jqueryui.com/demos/datepicker/">http://jqueryui.com/demos/datepicker/</a></p>
<p>You&#8217;ll find a lot more support for jQuery UI, and there are a lot more widgets to play with <img src='http://karlagius.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Devendra Dhaka</title>
		<link>http://karlagius.com/2009/11/25/revisiting-the-javascript-calendar-control-part-3/comment-page-1/#comment-1524</link>
		<dc:creator>Devendra Dhaka</dc:creator>
		<pubDate>Thu, 03 May 2012 09:06:03 +0000</pubDate>
		<guid isPermaLink="false">http://karlagius.com/?p=354#comment-1524</guid>
		<description>I am working on a project, where I need this calendar. I am new to javascript and jquery.

Can you help me to modify this calender ??

Thanks in advance.</description>
		<content:encoded><![CDATA[<p>I am working on a project, where I need this calendar. I am new to javascript and jquery.</p>
<p>Can you help me to modify this calender ??</p>
<p>Thanks in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith Pinster</title>
		<link>http://karlagius.com/2009/11/25/revisiting-the-javascript-calendar-control-part-3/comment-page-1/#comment-1441</link>
		<dc:creator>Keith Pinster</dc:creator>
		<pubDate>Wed, 11 May 2011 20:56:47 +0000</pubDate>
		<guid isPermaLink="false">http://karlagius.com/?p=354#comment-1441</guid>
		<description>For some reason, after moving the code into our ASP project, the bindCellBehaviour stopped working correctly.  How I fixed it was to move the call into the populateBody method.  I think this is a better solution all around, since you don&#039;t have to check and set the cellsBound variable. This sort of thing always strikes me as &quot;hacky.&quot;

Another &quot;hacky&quot; thing that I haven&#039;t figured out a way to get around was the binding of the selectCell call to each TD.  This code worked in my HTML page, but then again, when I moved it to my project, the filtering stopped working, so all the cells (even the disabled weekend cells) executed the Click event.  I tried everything from filtering on the class to adding a &quot;disabled&quot; attribute and filtering on that.  I also tried doing an &quot;unbind&quot; on any cell with that class or attribute, but the copy of jQuery that is in the app just isn&#039;t having any of it.

The way I worked around that is in the selectCell method, I added this code at the beginning:

if ($(this).hasClass(&#039;disabled&#039;)) return;

I don&#039;t like it, but it works.  Hope this helps someone out there that comes across this thread.</description>
		<content:encoded><![CDATA[<p>For some reason, after moving the code into our ASP project, the bindCellBehaviour stopped working correctly.  How I fixed it was to move the call into the populateBody method.  I think this is a better solution all around, since you don&#8217;t have to check and set the cellsBound variable. This sort of thing always strikes me as &#8220;hacky.&#8221;</p>
<p>Another &#8220;hacky&#8221; thing that I haven&#8217;t figured out a way to get around was the binding of the selectCell call to each TD.  This code worked in my HTML page, but then again, when I moved it to my project, the filtering stopped working, so all the cells (even the disabled weekend cells) executed the Click event.  I tried everything from filtering on the class to adding a &#8220;disabled&#8221; attribute and filtering on that.  I also tried doing an &#8220;unbind&#8221; on any cell with that class or attribute, but the copy of jQuery that is in the app just isn&#8217;t having any of it.</p>
<p>The way I worked around that is in the selectCell method, I added this code at the beginning:</p>
<p>if ($(this).hasClass(&#8216;disabled&#8217;)) return;</p>
<p>I don&#8217;t like it, but it works.  Hope this helps someone out there that comes across this thread.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith Pinster</title>
		<link>http://karlagius.com/2009/11/25/revisiting-the-javascript-calendar-control-part-3/comment-page-1/#comment-1435</link>
		<dc:creator>Keith Pinster</dc:creator>
		<pubDate>Tue, 03 May 2011 20:31:52 +0000</pubDate>
		<guid isPermaLink="false">http://karlagius.com/?p=354#comment-1435</guid>
		<description>In case there are people following along: there is a performance issue that Karl and I worked out.  It appears that the update function is calling the bindCellBehaviour method every time a date is picked.  This is required for the first update call, but no subsequent call. To fix this, add a class-level variable named cellsBound at the top of the js file and set it&#039;s default value to false.  Then, change the update function to be:

function update(table, repopulate) {
  if (repopulate)  populateBody(table);
  populateCaption(table);
  decorate(table);
  if (!cellsBound) {
    bindCellBehaviour(table);
    cellsBound = true;
  }
}</description>
		<content:encoded><![CDATA[<p>In case there are people following along: there is a performance issue that Karl and I worked out.  It appears that the update function is calling the bindCellBehaviour method every time a date is picked.  This is required for the first update call, but no subsequent call. To fix this, add a class-level variable named cellsBound at the top of the js file and set it&#8217;s default value to false.  Then, change the update function to be:</p>
<p>function update(table, repopulate) {<br />
  if (repopulate)  populateBody(table);<br />
  populateCaption(table);<br />
  decorate(table);<br />
  if (!cellsBound) {<br />
    bindCellBehaviour(table);<br />
    cellsBound = true;<br />
  }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith Pinster</title>
		<link>http://karlagius.com/2009/11/25/revisiting-the-javascript-calendar-control-part-3/comment-page-1/#comment-1434</link>
		<dc:creator>Keith Pinster</dc:creator>
		<pubDate>Tue, 03 May 2011 15:52:02 +0000</pubDate>
		<guid isPermaLink="false">http://karlagius.com/?p=354#comment-1434</guid>
		<description>I just emailed you all the files, so you can see directly what is happening.  


I REALLY appreciate all your help on this!</description>
		<content:encoded><![CDATA[<p>I just emailed you all the files, so you can see directly what is happening.  </p>
<p>I REALLY appreciate all your help on this!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith Pinster</title>
		<link>http://karlagius.com/2009/11/25/revisiting-the-javascript-calendar-control-part-3/comment-page-1/#comment-1433</link>
		<dc:creator>Keith Pinster</dc:creator>
		<pubDate>Tue, 03 May 2011 15:45:52 +0000</pubDate>
		<guid isPermaLink="false">http://karlagius.com/?p=354#comment-1433</guid>
		<description>The body of the HTML file is this:

The body of the HTML file is this:





  
    $(function() {
      // Create a new calendar with the given date selected.
      var minProcessDate = new Date();
      minProcessDate.setDate(minProcessDate.getDate() - 90);
      minProcessDate.setDate(1);
      var maxProcessDate = new Date();
      maxProcessDate.setDate(maxProcessDate.getDate() + 5);

	$(&quot;#target&quot;).calendar(new Date(), {
		className: &quot;redzone-calendar&quot;,
		allowWeekends: false,
		minimumDate: minProcessDate,
		maximumDate: maxProcessDate
	});

	// Switch the display to the current date.
	$(&quot;table&quot;).calendar(new Date());
});



  
   
     
	
	  
	    Cash In
	  
	
	
	  DHTML Class
	  $1.00
	
      
    
    
  


And the function is this:

    return this.each(function() {
        var target = jQuery(this);
        var isNew = !target.data(&quot;date.active&quot;);

        if (!target.is(&quot;table&quot;) &#124;&#124; isNew) {
            var table = createTable(target, options);
            populateHeader(table);
            setSelectedDate(table, date);
        }
        else {
            setActiveDate(target, date);
        }
    });</description>
		<content:encoded><![CDATA[<p>The body of the HTML file is this:</p>
<p>The body of the HTML file is this:</p>
<p>    $(function() {<br />
      // Create a new calendar with the given date selected.<br />
      var minProcessDate = new Date();<br />
      minProcessDate.setDate(minProcessDate.getDate() &#8211; 90);<br />
      minProcessDate.setDate(1);<br />
      var maxProcessDate = new Date();<br />
      maxProcessDate.setDate(maxProcessDate.getDate() + 5);</p>
<p>	$(&#8220;#target&#8221;).calendar(new Date(), {<br />
		className: &#8220;redzone-calendar&#8221;,<br />
		allowWeekends: false,<br />
		minimumDate: minProcessDate,<br />
		maximumDate: maxProcessDate<br />
	});</p>
<p>	// Switch the display to the current date.<br />
	$(&#8220;table&#8221;).calendar(new Date());<br />
});</p>
<p>	    Cash In</p>
<p>	  DHTML Class<br />
	  $1.00</p>
<p>And the function is this:</p>
<p>    return this.each(function() {<br />
        var target = jQuery(this);<br />
        var isNew = !target.data(&#8220;date.active&#8221;);</p>
<p>        if (!target.is(&#8220;table&#8221;) || isNew) {<br />
            var table = createTable(target, options);<br />
            populateHeader(table);<br />
            setSelectedDate(table, date);<br />
        }<br />
        else {<br />
            setActiveDate(target, date);<br />
        }<br />
    });</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karl</title>
		<link>http://karlagius.com/2009/11/25/revisiting-the-javascript-calendar-control-part-3/comment-page-1/#comment-1432</link>
		<dc:creator>Karl</dc:creator>
		<pubDate>Tue, 03 May 2011 15:16:51 +0000</pubDate>
		<guid isPermaLink="false">http://karlagius.com/?p=354#comment-1432</guid>
		<description>Assuming I understood the problem correctly, you &lt;em&gt;might&lt;/em&gt; have overlapping selectors on the two tables.

If you have, for example, 

&lt;code&gt;
&lt;div&gt;&lt;!-- calendar goes here --&gt;&lt;/div&gt;
&lt;div&gt;&lt;!-- events go here --&gt;&lt;/div&gt;
&lt;/code&gt;

and your script is 
&lt;code&gt;$(&quot;div&quot;).calendar(...)&lt;/code&gt;

That&#039;s the simplest way of reproducing the issue that I could think of.

Another idea that just occurred:

&lt;div id=&quot;calendar&quot;&gt;&lt;table id=&quot;events&quot;&gt;&lt;/table&gt;&lt;/div&gt;

In this case, both the calendar and the events would end up in the same container, and would be picked up by the same selector (being both tables in the same parent). A quick fix to this would be to move the table out of the calendar&#039;s container, or wrap the calendar container in such a way that the two tables are no longer siblings.</description>
		<content:encoded><![CDATA[<p>Assuming I understood the problem correctly, you <em>might</em> have overlapping selectors on the two tables.</p>
<p>If you have, for example, </p>
<p><code><br />
&lt;div&gt;&lt;!-- calendar goes here --&gt;&lt;/div&gt;<br />
&lt;div&gt;&lt;!-- events go here --&gt;&lt;/div&gt;<br />
</code></p>
<p>and your script is<br />
<code>$("div").calendar(...)</code></p>
<p>That&#8217;s the simplest way of reproducing the issue that I could think of.</p>
<p>Another idea that just occurred:</p>
<p>&lt;div id=&#8221;calendar&#8221;&gt;&lt;table id=&#8221;events&#8221;&gt;&lt;/table&gt;&lt;/div&gt;</p>
<p>In this case, both the calendar and the events would end up in the same container, and would be picked up by the same selector (being both tables in the same parent). A quick fix to this would be to move the table out of the calendar&#8217;s container, or wrap the calendar container in such a way that the two tables are no longer siblings.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith Pinster</title>
		<link>http://karlagius.com/2009/11/25/revisiting-the-javascript-calendar-control-part-3/comment-page-1/#comment-1431</link>
		<dc:creator>Keith Pinster</dc:creator>
		<pubDate>Tue, 03 May 2011 14:30:03 +0000</pubDate>
		<guid isPermaLink="false">http://karlagius.com/?p=354#comment-1431</guid>
		<description>Hmm.  Okay, I&#039;ll have to think about that one.  The nice thing about this particular code is that it only deals with between 3 and 4 months, so any loop will be very quick.  But you&#039;re right, eliminating loops is always better.

I ran into another problem I was hoping you could give me some direction on.  For the click event of a particular date, what I&#039;m doing is showing a grid (html table) below the calendar that lists 2 columns.  The problem is, now that I have a second table object, in the &quot;return this.each(function() {&quot; function, it tries to call the populateHeader method and pass in the table.  It also does this with the table I created to display the details.  How can I go about only processing in the calendar table and no other table on the page?</description>
		<content:encoded><![CDATA[<p>Hmm.  Okay, I&#8217;ll have to think about that one.  The nice thing about this particular code is that it only deals with between 3 and 4 months, so any loop will be very quick.  But you&#8217;re right, eliminating loops is always better.</p>
<p>I ran into another problem I was hoping you could give me some direction on.  For the click event of a particular date, what I&#8217;m doing is showing a grid (html table) below the calendar that lists 2 columns.  The problem is, now that I have a second table object, in the &#8220;return this.each(function() {&#8221; function, it tries to call the populateHeader method and pass in the table.  It also does this with the table I created to display the details.  How can I go about only processing in the calendar table and no other table on the page?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karl</title>
		<link>http://karlagius.com/2009/11/25/revisiting-the-javascript-calendar-control-part-3/comment-page-1/#comment-1430</link>
		<dc:creator>Karl</dc:creator>
		<pubDate>Fri, 29 Apr 2011 13:12:11 +0000</pubDate>
		<guid isPermaLink="false">http://karlagius.com/?p=354#comment-1430</guid>
		<description>Dang - thanks Keith :) No more coding after bedtime for me :D

I think you could also check if the current date is displayed. If the current date is NOT visible and the month falls outside the range, then all weekend dates get disabled. That would eliminate the while loop.</description>
		<content:encoded><![CDATA[<p>Dang &#8211; thanks Keith <img src='http://karlagius.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  No more coding after bedtime for me <img src='http://karlagius.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>I think you could also check if the current date is displayed. If the current date is NOT visible and the month falls outside the range, then all weekend dates get disabled. That would eliminate the while loop.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith Pinster</title>
		<link>http://karlagius.com/2009/11/25/revisiting-the-javascript-calendar-control-part-3/comment-page-1/#comment-1429</link>
		<dc:creator>Keith Pinster</dc:creator>
		<pubDate>Wed, 27 Apr 2011 22:30:19 +0000</pubDate>
		<guid isPermaLink="false">http://karlagius.com/?p=354#comment-1429</guid>
		<description>Here is how I fixed it:

while (today.getUTCMonth() &gt;= table.data(&quot;minimumDate&quot;).getUTCMonth()
  &amp;&amp; today.getUTCFullYear() &gt;= table.data(&quot;minimumDate&quot;).getUTCFullYear())
{
 jQuery(&quot;.d&quot; + today.getUTCDate()).filter(&quot;.m&quot; + today.getUTCMonth()).prevAll(&quot;td.dw0, td.dw6&quot;).addClass(&quot;disabled&quot;);

 jQuery(&quot;.d&quot; + today.getUTCDate()).filter(&quot;.m&quot; + today.getUTCMonth()).parent().prevAll().children(&quot;td.dw0, td.dw6&quot;).addClass(&quot;disabled&quot;);
 
 today.setMonth(today.getUTCMonth() - 1);
}</description>
		<content:encoded><![CDATA[<p>Here is how I fixed it:</p>
<p>while (today.getUTCMonth() &gt;= table.data(&#8220;minimumDate&#8221;).getUTCMonth()<br />
  &amp;&amp; today.getUTCFullYear() &gt;= table.data(&#8220;minimumDate&#8221;).getUTCFullYear())<br />
{<br />
 jQuery(&#8220;.d&#8221; + today.getUTCDate()).filter(&#8220;.m&#8221; + today.getUTCMonth()).prevAll(&#8220;td.dw0, td.dw6&#8243;).addClass(&#8220;disabled&#8221;);</p>
<p> jQuery(&#8220;.d&#8221; + today.getUTCDate()).filter(&#8220;.m&#8221; + today.getUTCMonth()).parent().prevAll().children(&#8220;td.dw0, td.dw6&#8243;).addClass(&#8220;disabled&#8221;);</p>
<p> today.setMonth(today.getUTCMonth() &#8211; 1);<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>

