<?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>Totti&#039;s Blog</title>
	<atom:link href="http://iamtotti.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://iamtotti.com/blog</link>
	<description>Javascript, and front-end stuff.</description>
	<lastBuildDate>Tue, 24 Aug 2010 17:21:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>ExtJS Accordion-Vbox custom hybrid layout</title>
		<link>http://iamtotti.com/blog/2010/08/extjs-accordion-vbox-custom-hybrid-layout/</link>
		<comments>http://iamtotti.com/blog/2010/08/extjs-accordion-vbox-custom-hybrid-layout/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 11:40:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ext JS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[accordion]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[vbox]]></category>

		<guid isPermaLink="false">http://iamtotti.com/blog/?p=289</guid>
		<description><![CDATA[ExtJs has two well-known layouts called Accordion and Vbox. Basically, in a vertical list of panels, AccordionLayout manages multiple Panels in an expandable accordion style such that only one Panel can be expanded at any given time. Each Panel has built-in support for expanding and collapsing. VboxLayout, on the other hand, arranges items vertically down [...]]]></description>
			<content:encoded><![CDATA[<p>ExtJs has two well-known layouts called Accordion and Vbox.</p>
<p>Basically, in a vertical list of panels, AccordionLayout manages multiple Panels in an expandable accordion style such that only one Panel can be expanded at any given time. Each Panel has built-in support for expanding and collapsing.</p>
<p>VboxLayout, on the other hand, arranges items vertically down a Container. This layout optionally divides available vertical space between child items containing a numeric <code>flex</code> configuration.</p>
<p>From the need of one of my projects, I came up with a <em>custom hybrid layout between Accordion and Vbox</em>..<span id="more-289"></span> that allows multiple panels to be collapsed at a time but the sizes of other expanded panels are automatically resized according to the new empty space available.</p>
<p>This is a very practical layout when you have a long vertical panel consisting of different sub-panels. Users can selectively collapse some unused panels, and all of the other expanded panels will take up the available space accordingly.</p>
<p>Main configuration follows the API doc of <a href="http://dev.sencha.com/deploy/dev/docs/output/Ext.layout.VBoxLayout.html" target="_blank">VboxLayout</a>.</p>
<p>You can check out the demo and comparison between layouts <a href="http://iamtotti.com/playground/js/ext-3.2.1/examples/layout-browser/layout-browser.html" target="_blank">here</a>.</p>
<p>Extension tested working on IE6+, FF3, Safari 4, Chrome, and Opera 10.54+ with <span style="color: #008000;">ExtJS 3.2.1</span></p>
<p><a href="http://code.google.com/p/ext-tot2ivn-accordion-vbox-layout/downloads/list" target="_blank">Download the source</a></p>
<p>You&#8217;re welcome if having any feedback. <img src='http://iamtotti.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Cheers,</p>
<p>Totti</p>
]]></content:encoded>
			<wfw:commentRss>http://iamtotti.com/blog/2010/08/extjs-accordion-vbox-custom-hybrid-layout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE z-index bug</title>
		<link>http://iamtotti.com/blog/2010/08/ie-z-index-bug/</link>
		<comments>http://iamtotti.com/blog/2010/08/ie-z-index-bug/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 01:54:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[z-index]]></category>

		<guid isPermaLink="false">http://iamtotti.com/blog/?p=253</guid>
		<description><![CDATA[Z-index bug on IE is a well-known flaw that most of front-end web developers have heard about. It is documented pretty clear on PPK Quirksmode: http://www.quirksmode.org/&#8230;/Explorer_z_index_bug.html and here http://therealcrisp.xs4all.nl/../IE-zindexbug.html Basically here is the break-down of the workaround&#8230; We have two div elements box1, nested in box3 and box2. &#60;div class=&#34;canvas&#34;&#62; &#60;div class=&#34;box&#34; id=&#34;box3&#34;&#62; &#60;div class=&#34;box&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>Z-index bug on IE is a well-known flaw that most of front-end web developers have heard about. It is documented pretty clear on PPK Quirksmode:</p>
<p><a href="http://www.quirksmode.org/bugreports/archives/2006/01/Explorer_z_index_bug.html" target="_blank">http://www.quirksmode.org/&#8230;/Explorer_z_index_bug.html</a></p>
<p>and here</p>
<p><a href="http://therealcrisp.xs4all.nl/meuk/IE-zindexbug.html" target="_blank">http://therealcrisp.xs4all.nl/../IE-zindexbug.html</a></p>
<p>Basically here is the break-down of the workaround&#8230;</p>
<p><span id="more-253"></span></p>
<p>We have two div elements <strong>box1</strong>, nested in <strong>box3</strong> and <strong>box2</strong>.</p>
<pre class="brush: xml;">
&lt;div class=&quot;canvas&quot;&gt;

		&lt;div class=&quot;box&quot; id=&quot;box3&quot;&gt;
			&lt;div class=&quot;box&quot; id=&quot;box1&quot;&gt;
				Box 1
			&lt;/div&gt;
		&lt;/div&gt;

		&lt;div class=&quot;box&quot; id=&quot;box2&quot;&gt;
			Box 2
		&lt;/div&gt;

	&lt;/div&gt;
</pre>
<p><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;"><span style="line-height: 19px; white-space: normal; font-size: small;"><span style="font-size: 13px;">And we want box1 to be on top of box2 by setting z-index as the following :</span></span></span><br />
<span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;"><span style="line-height: 19px; white-space: normal; font-size: small;"><span style="font-size: 13px;"> </span></span></span></p>
<pre style="font: normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;">
<pre class="brush: css;">

.canvas {
 position: relative;
}

.box {
 width: 50px;
 height: 50px;
 position: absolute;
}

#box1 {
 top: 20px;
 left: 20px;
 background: green;
 z-index: 4000;
}

#box2 {
 top: 50px;
 left: 50px;
 background: yellow;
 z-index: 3000;
}
</pre>
<p><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;">The above code makes <strong>box1</strong> appear on top of <strong>box2</strong> on all browsers except IE 6+ as positioned elements <em>do</em> generate a new stacking context, starting with z-index of 0.     In this case since </span><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;"><strong>box3 </strong>and <strong>box2</strong> are siblings (on the same level), and</span><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;"> <strong>box3 </strong>'s z-index is less than that of <strong>box2</strong>, so  <strong>box2</strong> and its child nodes ( <em>on a higher stacking context </em>) will be always on top of box3 and its child nodes.. even if some of box3's child nodes have higher z-index than those of box2 and its child nodes  ( <strong>box1 </strong>has z-index of 4000 but is still displayed beneath <strong>box2 </strong>of z-index 3000).     <span style="text-decoration: underline;"> </span></p>
<p>The solution here is to put <strong>box1 </strong>in a stacking context <em>higher </em>than that of <strong>box2 </strong>by making z-index of box3 higher than that of box2. </span>
<pre class="brush: css;">
#box3 {
  z-index: 30001;
}
</pre>
<p><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;">Now box1 is on top of box2 as desired !  How about two elements nested in &lt;td&gt; cells of the same table like this: </span>
<pre class="brush: xml;">
&lt;table&gt;
    &lt;tr&gt;
        &lt;td class=&quot;td3&quot;&gt;
             &lt;div class=&quot;box1&quot;&gt;&lt;/div&gt;
        &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
        &lt;td&gt;
             &lt;div class=&quot;box2&quot;&gt;&lt;/div&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;
</pre>
<p><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;">All you need to do is set the z-index of <strong>td3 </strong>higher than that of <strong>box2 </strong>to make <strong>td3 </strong>and its child nodes (including box1) stay on top of box2. </span></pre>
<pre class="brush: css;">
.td3 {
    position: relative;
    z-index: 3001;
}

.box {
	width: 50px;
	height: 50px;
	position: absolute;
}

#box1 {
         z-index: 4000;
}

#box2 {
         z-index: 3000;
}
</pre>
<pre><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;">You will notice I set <strong>td3</strong> to <em>position:relative</em> so that the TD cell still keeps its relative position with respect to other cells in the table.

That is for today <img src='http://iamtotti.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Feel free to share your ideas on this bug IE bug with us..

Cheers,

Totti
</span></pre>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 108px; width: 1px; height: 1px; overflow: hidden;">fdfd&lt;div&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 108px; width: 1px; height: 1px; overflow: hidden;"><span style="white-space: pre;"> </span></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 108px; width: 1px; height: 1px; overflow: hidden;"><span style="white-space: pre;"> </span>&lt;div id=&#8221;box1&#8243;&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 108px; width: 1px; height: 1px; overflow: hidden;"><span style="white-space: pre;"> </span>&lt;div id=&#8221;box2&#8243;&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 108px; width: 1px; height: 1px; overflow: hidden;"><span style="white-space: pre;"> </span>Box 2</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 108px; width: 1px; height: 1px; overflow: hidden;"><span style="white-space: pre;"> </span>&lt;/div&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 108px; width: 1px; height: 1px; overflow: hidden;"><span style="white-space: pre;"> </span>&lt;/div&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 108px; width: 1px; height: 1px; overflow: hidden;"><span style="white-space: pre;"> </span></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 108px; width: 1px; height: 1px; overflow: hidden;"><span style="white-space: pre;"> </span>&lt;div id=&#8221;box3&#8243;&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 108px; width: 1px; height: 1px; overflow: hidden;"><span style="white-space: pre;"> </span>Box 3</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 108px; width: 1px; height: 1px; overflow: hidden;"><span style="white-space: pre;"> </span>&lt;/div&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 108px; width: 1px; height: 1px; overflow: hidden;"><span style="white-space: pre;"> </span></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 108px; width: 1px; height: 1px; overflow: hidden;"><span style="white-space: pre;"> </span>&lt;/div&gt;</div>
]]></content:encoded>
			<wfw:commentRss>http://iamtotti.com/blog/2010/08/ie-z-index-bug/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ExtJS Vertical TabPanel example</title>
		<link>http://iamtotti.com/blog/2010/03/extjs-vertical-tabpanel-example/</link>
		<comments>http://iamtotti.com/blog/2010/03/extjs-vertical-tabpanel-example/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 02:16:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ext JS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[examples]]></category>
		<category><![CDATA[ExtJS]]></category>

		<guid isPermaLink="false">http://iamtotti.com/blog/?p=233</guid>
		<description><![CDATA[Currently, ExtJS 3.1.1 doesn&#8217;t support Vertical TabPanel. Here is my simple custom Vertical TabPanel ux class. Currently, it supports the same set of features as Ext.Tabpanel except advanced auto tab-scrolling feature. Default position is &#8220;left&#8221;. Tested working on FF3.6, IE7, IE8, Chrome 4, Safari 4, and Opera 10. You can put the source files in [...]]]></description>
			<content:encoded><![CDATA[<p>Currently, ExtJS 3.1.1 doesn&#8217;t support Vertical TabPanel. Here is my simple custom Vertical TabPanel ux class. Currently, it supports the same set of features as Ext.Tabpanel except advanced auto tab-scrolling feature. Default position is &#8220;left&#8221;.</p>
<p>Tested working on FF3.6, IE7, IE8, Chrome 4, Safari 4, and Opera 10.</p>
<p>You can put the source files in ExtJS Tabs folder to test: ext-3.1.1\examples\tabs\..</p>
<p>Check out the live example <a href="http://iamtotti.com/playground/js/ext-3.1.1/examples/tabs/tabs.html">here</a></p>
<p><a href="http://iamtotti.com/playground/js/ext-3.1.1/examples/tabs/Ext.ux.VrTabPanel.Examples.zip">Download </a>the whole example<br />
<a href="http://iamtotti.com/blog/wp-content/uploads/code/js/ext/Ext.ux.VrTabPanel.zip">Download </a>the extension code only</p>
<p><em><span style="color: #339966;">Extension updated to work with ExtJS 3.1.2</span></em></p>
<p>Cheers,</p>
<p>Totti</p>
]]></content:encoded>
			<wfw:commentRss>http://iamtotti.com/blog/2010/03/extjs-vertical-tabpanel-example/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>The interesting javascript window object</title>
		<link>http://iamtotti.com/blog/2010/02/the-interesting-javascript-window-object/</link>
		<comments>http://iamtotti.com/blog/2010/02/the-interesting-javascript-window-object/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 18:44:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://iamtotti.com/blog/?p=208</guid>
		<description><![CDATA[As we all know that in Javascript, the Window object is the global variable that contains attributes of the current opened window. An interesting part is this object also has a property called &#8216;window&#8216; which refers to itself. I&#8217;m not sure why this special object is implemented that way. alert(window); // object Window alert(window.window); // [...]]]></description>
			<content:encoded><![CDATA[<p>As we all know that in Javascript, the Window object is the global variable that contains attributes of the current opened window. An interesting part is this object also has a property called &#8216;<em>window</em>&#8216; which refers to itself. I&#8217;m not sure why this special object is implemented that way.<br />
<span id="more-208"></span></p>
<pre class="brush: jscript;">
alert(window);  // object Window
alert(window.window);   // object Window
alert(window.window.window);  // object Window
alert(window.window.window === window);   // true
</pre>
<p>A fun bit about this is the <strong>window </strong>object is read-only, while the <strong>self </strong>object, also referring to the current opened window, is not.</p>
<pre class="brush: jscript;">
// Try assigning window to null
window = null;
alert(window);  // object Window
window.window = null;
alert(window.window); // object Window

// Try assigning self to null
window.self = null;  // only on IE 6, 7 this will returns exception: 'Not Implemented'
alert(window.self)  // on other browsers, self now is null.
alert(window)  // object Window .
</pre>
<p>This proves that <strong>self </strong>object actually is just a reference of <strong>window</strong>. And <strong>self </strong>could be assigned to point to other objects while <strong>window </strong>remains intact.</p>
<p>Totti</p>
]]></content:encoded>
			<wfw:commentRss>http://iamtotti.com/blog/2010/02/the-interesting-javascript-window-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE and CSS class-chaining</title>
		<link>http://iamtotti.com/blog/2010/02/ie-and-css-class-chaining/</link>
		<comments>http://iamtotti.com/blog/2010/02/ie-and-css-class-chaining/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 13:26:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[class chaining]]></category>
		<category><![CDATA[IE]]></category>

		<guid isPermaLink="false">http://iamtotti.com/blog/?p=202</guid>
		<description><![CDATA[Internet Explorer 6, 7 both do NOT support CSS class-chaining as a couple of articles floating around on the internet say. Basically, CSS class-chaining is used to select HTML elements which have multiple CSS classes: For example: &#60;!-- single class --&#62; &#60;div class=&#34;cls3&#34;&#62;Single&#60;/div&#62; &#60;!-- multiple classes --&#62; &#60;div class=&#34;cls1 cls2 cls3&#34;&#62;Multiple&#60;/div&#62; To select the later [...]]]></description>
			<content:encoded><![CDATA[<p>Internet Explorer 6, 7 both do NOT support CSS class-chaining as a couple of articles floating around on the internet say. Basically, CSS class-chaining is used to select HTML elements which have multiple CSS classes:<br />
For example: </p>
<pre class="brush: xml;">
&lt;!-- single class --&gt;
&lt;div class=&quot;cls3&quot;&gt;Single&lt;/div&gt; 

&lt;!-- multiple classes --&gt;
&lt;div class=&quot;cls1 cls2 cls3&quot;&gt;Multiple&lt;/div&gt;
</pre>
<p><span id="more-202"></span><br />
To select the later element we can use  CSS class-chaining like:</p>
<pre class="brush: css;">
.cls1.cls2.cls3 {
    /* your style */
}
</pre>
<p>However, IE6, 7, will see this as </p>
<pre class="brush: css;">
.cls3 {
}
</pre>
<p>because <strong>.cls3</strong> is placed last in the chain .cls1.cls2<em>.cls3</em><br />
This selector .cls3 apparently applies to both the first and second HTML elements.</p>
<p>A workaround to this IE bug is using parent-child CSS selector by adding additional child elements:</p>
<pre class="brush: xml;">
&lt;div class=&quot;cls1 cls2 cls3&quot;&gt;Multiple&lt;/div&gt;
&lt;!-- now becomes --&gt;
&lt;div class=&quot;cls1&quot;&gt;
       &lt;div class=&quot;cls2&quot;&gt;
                 &lt;div class=&quot;cls3&quot;&gt;Multiple&lt;/div&gt;
       &lt;/div&gt;
&lt;/div&gt;
</pre>
<p>And now we can select this element by</p>
<pre class="brush: css;">
.cls1 .cls2 .cls3 {
    /* your style */
}
</pre>
<p>which is fully supported by IE 7+.</p>
<p>Cheers,</p>
<p>Totti</p>
]]></content:encoded>
			<wfw:commentRss>http://iamtotti.com/blog/2010/02/ie-and-css-class-chaining/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript: Function length vs arguments</title>
		<link>http://iamtotti.com/blog/2010/02/javascript-function-length-vs-arguments/</link>
		<comments>http://iamtotti.com/blog/2010/02/javascript-function-length-vs-arguments/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 18:59:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[arguments]]></category>
		<category><![CDATA[length]]></category>

		<guid isPermaLink="false">http://iamtotti.com/blog/?p=170</guid>
		<description><![CDATA[One of the reasons quite a number of programmers don&#8217;t like Javascript because it&#8217;s weird, behaving differently on different browsers.. and hard to debug.. However, it&#8217;s quite fun or even addictive to learn JS also for that reason. Below is a brief on two mysterious properties of Javascript functions : length, and arguments. arguments : [...]]]></description>
			<content:encoded><![CDATA[<p>One of the reasons quite a number of programmers don&#8217;t like Javascript because it&#8217;s weird, behaving differently on different browsers.. and hard to debug.. However, it&#8217;s quite fun or even addictive to learn JS also for that reason. Below is a brief on two mysterious properties of Javascript functions : <strong>length</strong>, and <strong>arguments</strong>.<br />
<span id="more-170"></span><br />
<strong>arguments</strong> :<br />
- available : only inside a function&#8217;s body<br />
- is : an array of parameters/arguments provided when the function is called.</p>
<p><strong>length</strong> :<br />
- available : both in/outside a function&#8217;s body. Could be called using : <em>functionName</em><strong>.</strong>length<br />
- is : the total number of arguments declared in the function&#8217;s signature</p>
<p>Below is the demo snippet showing how to use these properties:</p>
<pre class="brush: jscript;">
var myFunction = function(a, b, c, d, e) {
		// total number of params declared : TRUE
		alert(myFunction.length == 5);

		// real number of arguments provided : TRUE
		alert(arguments.length == 2);

		// you can also refer to the function using its name : TRUE
		alert(myFunction.arguments.length == 2);		

// how to refer to the arguments provided ?
		alert(a === 'x' &amp;&amp; arguments[0] === 'x');
		alert(b === 'y' &amp;&amp; arguments[1] === 'y');
};

// myFunction is called with two arguments only
myFunction( 'x', 'y' );

// total number of params declared : TRUE
alert(myFunction.length == 5);

// undefined : FALSE
alert(myFunction.arguments == 2);
</pre>
<p>Have fun,</p>
<p>Totti</p>
]]></content:encoded>
			<wfw:commentRss>http://iamtotti.com/blog/2010/02/javascript-function-length-vs-arguments/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ExtJS : How to disable browser context menu</title>
		<link>http://iamtotti.com/blog/2010/02/extjs-how-to-disable-browser-context-menuxt/</link>
		<comments>http://iamtotti.com/blog/2010/02/extjs-how-to-disable-browser-context-menuxt/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 17:06:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ext JS]]></category>
		<category><![CDATA[context menu]]></category>
		<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[right click]]></category>

		<guid isPermaLink="false">http://iamtotti.com/blog/?p=158</guid>
		<description><![CDATA[This is a quick solution to disabling browser default context menu when right-clicking in ExtJS. Ext.getBody().on(&#34;contextmenu&#34;, Ext.emptyFn, null, {preventDefault: true}); Basically, you can implement a TreePanel or other ExtJS components like: new Ext.tree.TreePanel({ listeners: { render: function() { // After the component has been rendered, disable the default browser context menu Ext.getBody().on(&#34;contextmenu&#34;, Ext.emptyFn, null, {preventDefault: [...]]]></description>
			<content:encoded><![CDATA[<p>This is a quick solution to disabling browser default context menu when right-clicking in ExtJS.</p>
<pre class="brush: jscript;">

Ext.getBody().on(&quot;contextmenu&quot;, Ext.emptyFn, null, {preventDefault: true});  
</pre>
<p><span id="more-158"></span><br />
Basically, you can implement a TreePanel or other ExtJS components like:</p>
<pre class="brush: jscript;">
new Ext.tree.TreePanel({
        listeners: {
               render: function() {
                       // After the component has been rendered, disable the default browser context menu
                       Ext.getBody().on(&quot;contextmenu&quot;, Ext.emptyFn, null, {preventDefault: true});
               },
               contextmenu: function(e) {
                       // Init your context menu
               }
        }
});
</pre>
<p>Tested working on FF 3.6, Chrome 3, Safari 4 and IE7. Opera 10 unfortunately fails.</p>
]]></content:encoded>
			<wfw:commentRss>http://iamtotti.com/blog/2010/02/extjs-how-to-disable-browser-context-menuxt/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>JSMag for FREE</title>
		<link>http://iamtotti.com/blog/2010/01/jsmag-for-free/</link>
		<comments>http://iamtotti.com/blog/2010/01/jsmag-for-free/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 15:51:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ebooks]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jsmag]]></category>
		<category><![CDATA[magazine]]></category>

		<guid isPermaLink="false">http://iamtotti.com/blog/?p=148</guid>
		<description><![CDATA[JSMag is currently kinda the only Javascript magazine for enthusiastic front-end developers. I&#8217;m a subscriber of this magazine, finding it really fun, and interesting to read, especially if you love Javascript. This is a must-read for you and only costs $4.99. You can purchase at JsMag or ..I will periodically, and per request, upload old [...]]]></description>
			<content:encoded><![CDATA[<p>JSMag is currently kinda the only Javascript magazine for enthusiastic front-end developers. I&#8217;m a subscriber of this magazine, finding it really fun, and interesting to read, especially if you love Javascript. This is a must-read for you <img src='http://iamtotti.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  and only costs $4.99. You can purchase at <a href="http://www.jsmag.com/">JsMag</a> or ..I will periodically, and per request, upload old JSMag for the &#8220;hungry&#8221;-minded to download <img src='http://iamtotti.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . However, I can&#8217;t upload the latest ones as ..you know <img src='http://iamtotti.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
<span id="more-148"></span><br />
Below are several issues I found very informative.<br />
<a href="http://iamtotti.com/ebooks/javascript/jsmag/jsmag_js1.pdf">Issue 1</a><br />
<a href="http://iamtotti.com/ebooks/javascript/jsmag/jsmag_js2.pdf">Issue 2</a><br />
<a href="http://iamtotti.com/ebooks/javascript/jsmag/jsmag_js4.pdf">Issue 4</a><br />
<a href="http://iamtotti.com/ebooks/javascript/jsmag/jsmag_js7.pdf">Issue 7</a><br />
<a href="http://iamtotti.com/ebooks/javascript/jsmag/jsmag_js8.pdf">Issue 8</a><br />
<a href="http://iamtotti.com/ebooks/javascript/jsmag/jsmag_js11.pdf">Issue 11</a></p>
<p>Totti</p>
]]></content:encoded>
			<wfw:commentRss>http://iamtotti.com/blog/2010/01/jsmag-for-free/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Learning Javascript, JQuery w John Resig</title>
		<link>http://iamtotti.com/blog/2010/01/learning-javascript-jquery-w-john-resig/</link>
		<comments>http://iamtotti.com/blog/2010/01/learning-javascript-jquery-w-john-resig/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 15:35:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[John Resig]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Teaching]]></category>

		<guid isPermaLink="false">http://iamtotti.com/blog/?p=141</guid>
		<description><![CDATA[John Resig, one of my favorite Javascript experts, recently has just released a site teaching advanced Javascript for intermediate programmers. I myself find this resource very informative. Hope you guys love it too. http://ejohn.org/apps/learn/ and also the page teaching jQuery at http://ejohn.org/apps/learn-jquery/ You could also find more of his lectures in the upcoming book called [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://ejohn.org/about/">John Resig</a>, one of my favorite Javascript experts, recently has just released a site teaching advanced Javascript for intermediate programmers. I myself find this resource very informative. Hope you guys love it too.</p>
<p><a href="http://ejohn.org/apps/learn/">http://ejohn.org/apps/learn/</a></p>
<p>and also the page teaching jQuery at <a href="http://ejohn.org/apps/learn-jquery/">http://ejohn.org/apps/learn-jquery/</a></p>
<p>You could also find more of his lectures in the upcoming book called <a href="http://ejohn.org/blog/50-off-secrets-of-the-javascript-ninja/">Secrets of Javascript Ninja</a>.</p>
<p>Totti</p>
]]></content:encoded>
			<wfw:commentRss>http://iamtotti.com/blog/2010/01/learning-javascript-jquery-w-john-resig/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A JavaScript Module Pattern</title>
		<link>http://iamtotti.com/blog/2009/12/a-javascript-module-pattern/</link>
		<comments>http://iamtotti.com/blog/2009/12/a-javascript-module-pattern/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 13:47:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Great Articles]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[pattern]]></category>

		<guid isPermaLink="false">http://iamtotti.com/blog/?p=114</guid>
		<description><![CDATA[This is the first episode in the collection of Great Javascript articles by world&#8217;s top-notched Javascript gurus. Our entry this week was written by Eric Miraglia originally posted on Y!UI Blog. Global variables are evil. Within YUI, we use only two globals: YAHOO and YAHOO_config. Everthing in YUI makes use of members within the YAHOO [...]]]></description>
			<content:encoded><![CDATA[<p>This is the first episode in the collection of Great Javascript articles by world&#8217;s top-notched Javascript gurus.<br />
Our entry this week was written by <a href="http://ericmiraglia.com/">Eric Miraglia</a> originally posted on <a href="http://www.yuiblog.com/blog/2007/06/12/module-pattern/">Y!UI Blog.</a></p>
<p>Global variables are evil. Within YUI, we use only two globals: <em>YAHOO </em>and <em>YAHOO_config</em>. Everthing in YUI makes use of members within the YAHOO object hierarchy or variables that are scoped to such a member. We advise that you exercise similar discipline in your own applications, too.</p>
<p>Douglas Crockford has been teaching a useful singleton pattern for achieving this discipline, and I thought his pattern might be of interest to those of you building on top of YUI. Douglas calls this the “module pattern.” Here’s how it works:<br />
<span id="more-114"></span><br />
<strong>1. Create a namespace object</strong>: If you’re using YUI, you can use the YAHOO.namespace() method: </p>
<pre class="brush: jscript;">
YAHOO.namespace(&quot;myProject&quot;);
</pre>
<p>This assigns an empty object myProject as a member of YAHOO (but doesn’t overwrite myProject if it already exists). Now we can begin adding members to YAHOO.myProject.</p>
<p><strong>2. Assign the return value of an anonymous function</strong> to your namespace object:</p>
<pre class="brush: jscript;">
YAHOO.myProject.myModule = function () {
	return  {
		myPublicProperty: &quot;I'm accessible as YAHOO.myProject.myModule.myPublicProperty.&quot;,
		myPublicMethod: function () {
			YAHOO.log(&quot;I'm accessible as YAHOO.myProject.myModule.myPublicMethod.&quot;);
		}
	};

}(); // the parens here cause the anonymous function to execute and return
</pre>
<p>Note the very last line with the closing curly brace and then the parentheses () — this notation causes the anonymous function to execute immediately, returning the object containing <em>myPublicProperty </em>and <em>myPublicMethod</em>. As soon as the anonymous function returns, that returned object is addressable as <em>YAHOO.myProject.myModule</em>. </p>
<p><strong>3. Add “private” methods and variables</strong> in the anonymous function prior to the return statement. So far, the above code hasn’t bought us any more than we could have gotten by assigning <em>myPublicProperty </em>and <em>myPublicMethod </em>directly to <em>YAHOO.myProject.myModule</em>. But the pattern does provide added utility when we place code before the return statement:</p>
<pre class="brush: jscript;">
YAHOO.myProject.myModule = function () {

	//&quot;private&quot; variables:
	var myPrivateVar = &quot;I can be accessed only from within YAHOO.myProject.myModule.&quot;;

	//&quot;private&quot; method:
	var myPrivateMethod = function () {
		YAHOO.log(&quot;I can be accessed only from within YAHOO.myProject.myModule&quot;);
	}

	return  {
		myPublicProperty: &quot;I'm accessible as YAHOO.myProject.myModule.myPublicProperty.&quot;
		myPublicMethod: function () {
			YAHOO.log(&quot;I'm accessible as YAHOO.myProject.myModule.myPublicMethod.&quot;);

			//Within myProject, I can access &quot;private&quot; vars and methods:
			YAHOO.log(myPrivateVar);
			YAHOO.log(myPrivateMethod());

			//The native scope of myPublicMethod is myProject; we can
			//access public members using &quot;this&quot;:
			YAHOO.log(this.myPublicProperty);
		}
	};

}(); // the parens here cause the anonymous function to execute and return
</pre>
<p>In the codeblock above, we’re returning from an anonymous function an object with two members. These members are addressable from within <em>YAHOO.myProject.myModule</em> as this.myPublicProperty and this.myPublicMethod respectively. From outside of <em>YAHOO.myProject.myModule</em>, these public members are addressable as <em>YAHOO.myProject.myModule</em>.myPublicProperty and <em>YAHOO.myProject.myModule</em>.myPublicMethod.</p>
<p>The private variables myPrivateProperty and myPrivateMethod can only be accessed from within the anonymous function itself or from within a member of the returned object. They are preserved, despite the immediate execution and termination of the anonymous function, through the power of closure — the principle by which variables local to a function are retained after the function has returned. As long as YAHOO.myProject.myModule needs them, our two private variables will not be destroyed.</p>
<p><strong>4. Do something useful with the pattern.</strong> Let’s look at a common use case for the module pattern. Suppose you have a list, some of whose list items should be draggable. The draggable items have the CSS class draggable applied to them.</p>
<pre class="brush: xml;">
&lt;!--This script file includes all of the YUI utilities:--&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://yui.yahooapis.com/2.2.2/build/utilities/utilities.js&quot;&gt;&lt;/script&gt;

&lt;ul id=&quot;myList&quot;&gt;
	&lt;li class=&quot;draggable&quot;&gt;Item one.&lt;/li&gt;
	&lt;li&gt;Item two.&lt;/li&gt; &lt;!--item two won't be draggable--&gt;
	&lt;li class=&quot;draggable&quot;&gt;Item three.&lt;/li&gt;
&lt;/ul&gt;
</pre>
<pre class="brush: jscript;">
&lt;script&gt;
YAHOO.namespace(&quot;myProject&quot;);
YAHOO.myProject.myModule = function () {

	//private shorthand references to YUI utilities:
	var yue = YAHOO.util.Event,
		yud = YAHOO.util.Dom;

	//private method:
	var getListItems = function () {

		//note that we can use other private variables here, including
		//our &quot;yud&quot; shorthand to YAHOO.util.Dom:
		var elList = yud.get(&quot;myList&quot;);
		var aListItems = yud.getElementsByClassName(
			&quot;draggable&quot;, //get only items with css class &quot;draggable&quot;
			&quot;li&quot;, //only return list items
			elList //restrict search to children of this element
		);
		return aListItems;
	};

	//the returned object here will become YAHOO.myProject.myModule:
	return  {

		aDragObjects: [], //a publicly accessible place to store our DD objects

		init: function () {
			//we'll defer making list items draggable until the DOM is fully loaded:
			yue.onDOMReady(this.makeLIsDraggable, this, true);
		},

		makeLIsDraggable: function () {
			var aListItems = getListItems(); //these are the elements we'll make draggable
			for (var i=0, j=aListItems.length; i&lt;j; i++) {
				this.aDragObjects.push(new YAHOO.util.DD(aListItems[i]));
			}
		}

	};
}(); // the parens here cause the anonymous function to execute and return

//The above code has already executed, so we can access the init
//method immediately:
YAHOO.myProject.myModule.init();
&lt;/script&gt;
</pre>
<p>This example is a simple one, and it’s deliberately verbose — if this was all we were doing, we could doubtless write it in a more compact way. However, this pattern scales well as the project becomes more complex and as its API grows. It stays out of the global namespace, provides publicly addressable API methods, and supports protected or “private” data and methods along the way.</p>
]]></content:encoded>
			<wfw:commentRss>http://iamtotti.com/blog/2009/12/a-javascript-module-pattern/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
