<?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>Sat, 12 Nov 2011 15:52:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>What makes your ExtJS application run so slow ?</title>
		<link>http://iamtotti.com/blog/2011/05/what-makes-your-extjs-application-run-so-slow/</link>
		<comments>http://iamtotti.com/blog/2011/05/what-makes-your-extjs-application-run-so-slow/#comments</comments>
		<pubDate>Sun, 15 May 2011 09:25:49 +0000</pubDate>
		<dc:creator>Totti</dc:creator>
				<category><![CDATA[Ext JS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://iamtotti.com/blog/?p=369</guid>
		<description><![CDATA[By “slow” here I mean the slow run-time, not the load time of resources. In the past one year and a half, I have been working at Bosch Software Innovations, Robert Bosch, where our frontend technology stack heavily relies on ExtJS. I had chances to develop Visual Rules Web Modeler and helped with several other [...]]]></description>
			<content:encoded><![CDATA[<p>By “<strong>slow</strong>” here I mean the slow <strong>run-time</strong>, not the load time of resources.</p>
<p>In the past one year and a half, I have been working at Bosch Software Innovations, Robert Bosch, where our frontend technology stack heavily relies on ExtJS. I had chances to develop <a href="http://www.visual-rules.com/business-rules-management-vr5.html">Visual Rules Web Modeler</a> and helped with several other ExtJS-based apps  and I did experience a lot of performance issues with ExtJS apps in common.</p>
<p>In this article, I’m gonna share with you the key bottlenecks that might cause an ExtJS app to run slow, and also point out the mistakes that rookie ExtJS devs most likely make.</p>
<p>ExtJS in this article refers to the version <strong>3.3.x</strong> and below.</p>
<h1><strong>1. </strong><strong>Over-declaration of Ext.Panel</strong></h1>
<p>The most used ExtJS component, IMO, would be <a title="Ext.Panel" href="http://dev.sencha.com/deploy/ext-3.3.1/docs/output/Ext.Panel.html" target="_blank">Ext.Panel</a>. Declaring a panel with ExtJS is so simple that developers could easily over-declare them. Below is a typical declaration of a panel with nested sub-panels.</p>
<pre class="brush: jscript; title: ; notranslate">
var panel = new Ext.Panel({         // Level-1
     title: 'Multi Column, Nested Layouts and Anchoring',
     bodyStyle:'padding:5px 5px 0',
     width: 600,
     items: [{                   // Level-2
        layout:'column',
        items:[{                // Level-3
               columnWidth:.5,
               layout: 'vbox',
               items: [{           // Level-4
                  html: 'This is some text'
               }, {
                  html: 'This is another text'
               }]
        },{
               columnWidth:.5,
               layout: 'form',
               items: [{
                      xtype:'textfield',
                      fieldLabel: 'Last Name',
                      name: 'last',
                      anchor:'95%'
               },{
                      xtype:'textfield',
                      fieldLabel: 'Email',
                      name: 'email',
                      vtype:'email',
                      anchor:'95%'
               }]
       }]
   }]
});
</pre>
<p>Any problem with this config ? NooO !? The problem is that this panel has <strong>four </strong>nested levels of panels, but it actually needs <strong>two </strong>in order to work and look as desired.</p>
<ul>
<li>This is an example of over-declaration which leads to seriously deep nested level of HTMLElements created, and severely affects the initialization/rendering time and run time of the component.</li>
</ul>
<ul>
<li>I’ve seen ExtJS developers who just like to declare nested panels because it’s convenient for them to put some CSS styles, text or images inside.. or sometimes just because adding another level of panel makes the form look as desired !?!</li>
</ul>
<ul>
<li>The rule of thumb is: <strong><span style="color: #800000;">use as few panels and nested levels of components/panels as possible</span></strong>.</li>
</ul>
<p>To achieve this you need to wisely make use of Ext <a href="http://dev.sencha.com/deploy/ext-3.3.1/docs/?class=Ext.layout.ContainerLayout" target="_blank">layouts</a> and CSS styles when declaring a complex component.</p>
<h1><strong>2. </strong><strong>Delay the HTMLElement creation whenever possible</strong></h1>
<p>Interacting (Read/Write) with the DOM is always not cheap, especially on IE 6, reading the DOM also causes re-flow.</p>
<p>So the rule of thumb is: <strong><span style="color: #800000;">try to delay the creation of HTMLElements whenever possible</span></strong>. This could be achieved by:</p>
<ul>
<li>Component Lazy instantiation. This is possible with <a href="http://dev.sencha.com/deploy/ext-3.3.1/docs/source/Component.html#cfg-Ext.Component-xtype" target="_blank">xtype</a>.</li>
<li>Try to defer expensive operations till <a href="http://dev.sencha.com/deploy/ext-3.3.1/docs/source/Component.html#event-Ext.Component-afterrender" target="_blank">afterrender</a>.</li>
<li>Avoid unnecessarily instantiating/rendering components in the <strong>constructor </strong>or <strong>initComponent </strong>of another component.</li>
</ul>
<p><strong>Example 1</strong>: A simple example is do not create <a href="http://dev.sencha.com/deploy/ext-3.3.1/docs/output/Ext.ToolTip.html" target="_blank">Ext.Tooltip</a> and render it hiddenly in the DOM when the button is first rendered. The tooltip usually should be rendered at the first time users hover mouse over the button. If tooltip is rendered right after the button, and users never hover mouse over the button. We have already created a wasted, never-used tooltip which adds up to the performance issue.</p>
<p><a href="http://iamtotti.com/blog/wp-content/uploads/2011/05/button-tooltip.gif"><img class="aligncenter size-full wp-image-376" title="button-tooltip" src="http://iamtotti.com/blog/wp-content/uploads/2011/05/button-tooltip.gif" alt="" width="219" height="65" /></a></p>
<p><strong>Example 2</strong>: Another example is careless use of <a href="http://dev.sencha.com/deploy/ext-3.3.1/docs/source/Component.html#cfg-Ext.Component-renderTo" target="_blank">renderTo</a>:</p>
<pre class="brush: jscript; title: ; notranslate">
var window = new Ext.Window({
     renderTo: document.body,
     title: 'The Untitled'
});

window.show(); // the window has been rendered before this line
</pre>
<p>With the above declaration, the window will be rendered immediately and hidden to the &lt;body&gt; tag. In many cases, we don’t need the <a href="http://dev.sencha.com/deploy/ext-3.3.1/docs/source/Component.html#cfg-Ext.Component-renderTo" target="_blank">renderTo</a>,  the window should be rendered only when it is displayed the first time as following:</p>
<pre class="brush: jscript; title: ; notranslate">
var window = new Ext.Window({
       title: 'The Untitled'
});

window.show(); // the window is to be rendered and displayed at this line
</pre>
<h1><strong>3. </strong><strong>Use the delegate pattern whenever possible:</strong></h1>
<p>I’m not gonna dig into the details of delegate pattern here, but will rephrase it in ExtJS language instead.</p>
<p><strong>Example</strong>: An example of delegate pattern is that you have an <a href="http://dev.sencha.com/deploy/ext-3.3.1/docs/output/Ext.Toolbar.html" target="_blank">Ext.Toolbar</a> with 10 <a href="http://dev.sencha.com/deploy/ext-3.3.1/docs/output/Ext.Button.html" target="_blank">Ext.Button</a>, and you need to assign <a href="http://dev.sencha.com/deploy/ext-3.3.1/docs/output/Ext.ToolTip.html" target="_blank">Ext.Tooltip</a> to every button so that when users hover mouse over a button, a Tooltip is displayed with an explanation text.</p>
<p>If you create 10 Ext.Tooltip and assign them to 10 Ext.Button then it is not the most optimized solution. You can create only 1 Ext.Tooltip and assign it to the parent element, which is Ext.Toolbar, of those 10 Ext.Button.</p>
<p>When users hover mouse over the Ext.Toolbar, you will display the same Ext.Tooltip but with different explanation text according to the target element ( actual Ext.Button ) being mouse over. (See <a href="http://dev.sencha.com/deploy/ext-3.3.1/docs/source/EventManager.html#method-Ext.EventObject-getTarget">getTarget</a> for how to get target element)</p>
<p>With this technique, only 1 Ext.Tooltip is created, and 1 event listener is attached to the Ext.Toolbar.</p>
<ul>
<li><strong><span style="color: #800000;">Saves you a lot of memory usage and run time of your app but still achieves the same result</span></strong>.</li>
</ul>
<p>You might want to look at <a href="http://dev.sencha.com/deploy/ext-3.3.1/docs/source/ToolTip.html#cfg-Ext.ToolTip-delegate" target="_blank">delegate </a>config property of Ext.Tooltip for the sample implementation.</p>
<h1><strong>4. </strong><strong>Component destruction – How to destroy things properly</strong></h1>
<p>This is one of the main bottlenecks I found in the slow ExtJS apps that I have helped improving the performance. The idea is when a component is not in use any more, we should clean up :</p>
<ul>
<li>The HTMLElements existing in the DOM</li>
<li>Dettach all event listeners to avoid memory leaks.</li>
<li>Destroy all descendant components in the same recursive way</li>
</ul>
<p>These above are handled in the method <a href="http://dev.sencha.com/deploy/ext-3.3.1/docs/source/Component.html#method-Ext.Component-destroy" target="_blank">destroy</a> of an Ext.Component. There are cases you need to call #<a href="http://dev.sencha.com/deploy/ext-3.3.1/docs/source/Component.html#method-Ext.Component-destroy" target="_blank">destroy</a> method during run time as leaving unused components in the DOM would lead to severe slow performance.</p>
<p><strong>Example 1</strong>: if you happen to create a custom Context Menu (<a href="http://dev.sencha.com/deploy/ext-3.3.1/docs/?class=Ext.menu.Menu" target="_blank">Ext.menu.Menu</a>) inside a panel (Ext.Panel), remember to override the destroy method of the panel, and destroy the context menu in there. Later if the panel gets destroyed, your context menu gets destroyed too.</p>
<pre class="brush: jscript; title: ; notranslate">
Your.Component.Klass = Ext.extend(Ext.Component, {
initComponent: function(){
     // Initialize your custom stuff
     this.contextMenu = new Ext.menu.Menu({
           renderTo: document.body
           // ..
      });
},

destroy: function(){
      // Destroy your custom stuff
      this.contextMenu.destroy();
      this.contextMenu = null;

      // Destroy the component
      Your.Component.Klass.superclass.destroy.call(this);
}
});
</pre>
<p><strong>Example 2</strong>: One common mistake is the misuse of config option closeAction of Ext.Window.</p>
<p>If you configure <a href="http://dev.sencha.com/deploy/ext-3.3.1/docs/source/Window.html#cfg-Ext.Window-closeAction" target="_blank">closeAction</a> as &#8216;<strong>hide</strong>&#8216;, the window will be hidden when users hit the ‘Close’ button. However, there is a chance that, the window will never be displayed again through out the whole run time. So make sure if yosu really want to do the show/hide, otherwise always configure closeAction as &#8216;<strong>close</strong>&#8216; for the .destroy method will be called on the window after it is hidden to destroy it properly.</p>
<pre class="brush: jscript; title: ; notranslate">
var window = new Ext.Window({
   closeAction: 'hide',
   title: 'The Untitled'
});

window.show(); // render and display the window
window.hide(); // the window is not destroyed but only hidden in the DOM.
</pre>
<p>I hope this article would give you some clues fighting with performance issues of your ExtJS-based applications. If you have other experience regarding performance issues specific to ExtJS apps, feel free to share here ! <img src='http://iamtotti.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Cheers,</p>
<p>Totti</p>
]]></content:encoded>
			<wfw:commentRss>http://iamtotti.com/blog/2011/05/what-makes-your-extjs-application-run-so-slow/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>ExtJS &#8211; How to scroll Ext.Panel by Drag and Drop ?</title>
		<link>http://iamtotti.com/blog/2010/09/extjs-how-to-scroll-ext-panel-by-drag-and-drop-using-ext-dd-dragzone/</link>
		<comments>http://iamtotti.com/blog/2010/09/extjs-how-to-scroll-ext-panel-by-drag-and-drop-using-ext-dd-dragzone/#comments</comments>
		<pubDate>Sat, 18 Sep 2010 17:43:32 +0000</pubDate>
		<dc:creator>Totti</dc:creator>
				<category><![CDATA[Ext JS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[custom extension]]></category>
		<category><![CDATA[drag and drop]]></category>
		<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[panel]]></category>
		<category><![CDATA[scrolling]]></category>

		<guid isPermaLink="false">http://iamtotti.com/blog/?p=318</guid>
		<description><![CDATA[In an ExtJS panel (Ext.Panel) where the content area is huge but the Panel size is limited, users usually use the MouseWheel to scroll vertically Up and Down. However, the Drag n Drop feature could actually allow users to scroll both vertically and horizontally by dragging and dropping the content (or body) of Ext.Panel. In [...]]]></description>
			<content:encoded><![CDATA[<p>In an ExtJS panel (<a href="http://dev.sencha.com/deploy/dev/docs/?class=Ext.Panel" target="_blank">Ext.Panel</a>) where the content area is huge but the Panel size is limited,<br />
users usually use the MouseWheel to scroll vertically Up and Down.<br />
However, the Drag n Drop feature could actually allow users to scroll both vertically and horizontally by dragging and dropping the content (or body) of Ext.Panel.</p>
<p>In this entry, I&#8217;ll walk you guys through a simple implementation of scrolling Ext.Panel<br />
Vertically and Horizontally by Dragging and Dropping using Ext.dd.DragZone.<br />
<span id="more-318"></span><br />
Examples of sites having this feature:<br />
1. <a href="http://maps.google.com/" target="_blank">maps.google.com</a> (Use .<em>png </em>files for hand cursors)<br />
2. <a href="http://gothere.sg/" target="_blank">gothere.sg</a> (Use .<em>cur </em>files for hand cursors)</p>
<p>In these cases, users don&#8217;t need to manually move the mouse to the horizontal / vertical scrollbars and slide them, they could do the scrolling by just <strong>dragging the content around</strong>. The <strong>map </strong>implementation is a typical example.</p>
<p>I wrapped this panel together with the DragZone in a simple Panel extension.<br />
<iframe src="http://iamtotti.com/playground/js/ext-3.2.1/examples/dd-panel/iframe.html" width="450" height="330" border="0"><br />
</iframe><br />
The main idea is create CSS classes to show the hand icons when users move and drag the panel body:</p>
<pre class="brush: css; title: ; notranslate">

.x-panel-wrap-dd-area {
 cursor: url(../images/open_hand.cur), pointer;        /* Show open_hand cursor */
 -moz-user-select: none;                                /* Disable text selection */
 -webkit-user-select: none;
}

.ext-ie .x-panel-wrap-dd-area {
 cursor: url(images/open_hand.cur), pointer;            /* Show open_hand cursor */
}

.x-panel-wrap-dd-area-scrolling {
 cursor: url(../images/closed_hand.cur), pointer;    /* Show closed_hand cursor */
}

.ext-ie .x-panel-wrap-dd-area-scrolling {
 cursor: url(images/closed_hand.cur), pointer;        /* Show closed_hand cursor */
}
</pre>
<p>You can have a look at the <a href="http://iamtotti.com/playground/js/ext-3.2.1/examples/dd-panel/panels.html" target="_blank">Demo page</a> and the source code. <img src='http://iamtotti.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Cheers,</p>
<p>Totti</p>
]]></content:encoded>
			<wfw:commentRss>http://iamtotti.com/blog/2010/09/extjs-how-to-scroll-ext-panel-by-drag-and-drop-using-ext-dd-dragzone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>Totti</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>18</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>Totti</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. And we want box1 to be on [...]]]></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; title: ; notranslate">
&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; title: ; notranslate">

.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; title: ; notranslate">
#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; title: ; notranslate">
&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; title: ; notranslate">
.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>Totti</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 FF2+, IE6+, Chrome 4, Safari 4, and Opera 10. You can put the source files in ExtJS [...]]]></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 FF2+, IE6+, 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.3.0/examples/tabs/tabs.html" target="_blank">here</a></p>
<p><a href="http://code.google.com/p/ext-tot2ivn-vertical-tabpanel/downloads/detail?name=Ext.ux.tot2ivn.VrTabPanel_v0.21_Examples.zip&amp;can=2&amp;q=" target="_blank">Download</a> the whole example<br />
<a href="http://code.google.com/p/ext-tot2ivn-vertical-tabpanel/downloads/detail?name=Ext.ux.tot2ivn.VrTabPanel_v0.21.zip&amp;can=2&amp;q=" target="_blank">Download</a> the extension code only</p>
<p><span style="color: #339966;"><em> </em><em><strong>21/10/2010</strong> : Released <strong>v0.2</strong>. Updated to work with ExtJS 3.3</em></span></p>
<p><span style="color: #339966;"><em><em><strong>02/03/2011</strong> : Released <strong>v0.21</strong>. CSS minor bugs fixed.</em><br />
</em></span></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>33</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>Totti</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://iamtotti.com/blog/?p=208</guid>
		<description><![CDATA[As we all know that in Client-side Javascript, the Window object is the global variable, a host object, 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. A fun [...]]]></description>
			<content:encoded><![CDATA[<p>As we all know that in Client-side Javascript, the Window object is the global variable, a host object, 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; title: ; notranslate">
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; title: ; notranslate">
// 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>Just my 2 cents with <strong>window </strong>on Firefox <img src='http://iamtotti.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </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>Totti</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: To select the later element we can use CSS class-chaining like: However, IE6, 7, will see this as [...]]]></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; title: ; notranslate">
&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; title: ; notranslate">
.cls1.cls2.cls3 {
    /* your style */
}
</pre>
<p>However, IE6, 7, will see this as</p>
<pre class="brush: css; title: ; notranslate">
.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; title: ; notranslate">
&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; title: ; notranslate">
.cls1 .cls2 .cls3 {
    /* your style */
}
</pre>
<p>which is fully supported by IE 6+.</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>2</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>Totti</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; title: ; notranslate">
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>Totti</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. Basically, you can implement a TreePanel or other ExtJS components like: Tested working on FF 3.6, Chrome 3, Safari 4 and IE7. Opera 10 unfortunately fails.]]></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; title: ; notranslate">

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; title: ; notranslate">
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>6</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>Totti</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 />
Issue 1<span style="text-decoration: underline;"><br />
</span>Issue 2<span style="text-decoration: underline;"><br />
</span>Issue 4<span style="text-decoration: underline;"><br />
</span>Issue 7<span style="text-decoration: underline;"><br />
</span>Issue 8<span style="text-decoration: underline;"><br />
</span>Issue 11</p>
<p>Totti</p>
<p><em>Oct 06, 2010 : Links removed due to request by editor</em></p>
]]></content:encoded>
			<wfw:commentRss>http://iamtotti.com/blog/2010/01/jsmag-for-free/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching using disk: basic
Object Caching 1203/1374 objects using disk: basic

Served from: iamtotti.com @ 2012-02-23 05:13:51 -->
