<?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>Saki's Blog &#187; design</title>
	<atom:link href="http://blog.extjs.eu/tag/design/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.extjs.eu</link>
	<description>For good of all productive developers</description>
	<lastBuildDate>Mon, 16 Aug 2010 23:12:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>xtype defined</title>
		<link>http://blog.extjs.eu/know-how/xtype-defined/</link>
		<comments>http://blog.extjs.eu/know-how/xtype-defined/#comments</comments>
		<pubDate>Fri, 09 May 2008 00:51:06 +0000</pubDate>
		<dc:creator>Saki</dc:creator>
				<category><![CDATA[Know-how]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[extjs]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.extjs.eu/?p=67</guid>
		<description><![CDATA[<br/>Preface
There has been a lot of confusion I have observed on the Ext Forums as to xtype. Some people ignore it fully, some think that it is what it is not. So I&#8217;ve decided to clarify it.
Definition
xtype is a symbolic name given to a class. Nothing less, nothing more. 
For example, your class has the [...]]]></description>
			<content:encoded><![CDATA[<br/><h1>Preface</h1>
<p>There has been a lot of confusion I have observed on the Ext Forums as to xtype. Some people ignore it fully, some think that it is what it is not. So I&#8217;ve decided to clarify it.</p>
<h1>Definition</h1>
<p><b>xtype</b> is a symbolic name given to a class. Nothing less, nothing more. </p>
<p>For example, your class has the name <b><code>Ext.ux.MyGrid</b></code>. This is the normal <b>class name</b> that you use when you need to instantiate this class (create an object of the class).</p>
<p>In addition to class name you can give your class <b>xtype</b> this way:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Ext.<span style="color: #660066;">reg</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'mygrid'</span><span style="color: #339933;">,</span> Ext.<span style="color: #660066;">ux</span>.<span style="color: #660066;">MyGrid</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><b>xtype</b> here is <b><code>mygrid</code></b> and normal class name is <b><code>Ext.ux.MyGrid</code></b>. The above statement <em>registers</em> a new <b>xtype</b> or, in other words, connects <b>xtype <code>mygrid</code></b> with class <b><code>Ext.ux.MyGrid</code></b>.</p>
<h1>What is it good for?</h1>
<p>Imagine you have a big application where objects (windows, forms, grids) are created when they are needed as responses to user actions. For example, the user clicks an icon or button and a new window with a grid inside is created, rendered and displayed on the screen.</p>
<p>Now, if you code such application in an before-Ext-2.x way you need to instantiate all objects in the application at the time of first page loading (application code first run). You will have an object of class <b><code>Ext.ux.MyGrid</code></b> somewhere in the browser&#8217;s memory waiting for rendering on a user click.</p>
<p>This is just for one grid &#8211; you may have hundreds of them&#8230; What a waste of resources! The grid is sitting somewhere there but the user may never click that button, may never need that grid.</p>
<h1>Lazy Instantiation</h1>
<p>If you have <b>xtype</b>, the only thing that sits in the memory is a simple configuration object such as:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#123;</span>xtype<span style="color: #339933;">:</span><span style="color: #3366CC;">'mygrid&quot;, border:false, width:600, height:400, ...}</span></pre></div></div>

<p>That is not as expensive as a complex instantiated class.</p>
<p>Now, what happens if the user clicks our button? Ext will see that the to-be-rendered-grid is not even instantiated but it knows how to deal with it. ComponentMgr knows: &#8220;If I need to instantiate an object of <b>xtype <code>mygrid</code></b> I need to create an object of class <b><code>Ext.ux.MyGrid</code></b>&#8221; so it runs this code:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">create <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #339933;">,</span> defaultType<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">new</span> types<span style="color: #009900;">&#91;</span>config.<span style="color: #660066;">xtype</span> <span style="color: #339933;">||</span> defaultType<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>In other &#8220;words&#8221;:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">new</span> Ext.<span style="color: #660066;">ux</span>.<span style="color: #660066;">MyGrid</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>That instantiates our grid; rendering and displaying will follow. Remember: <b>Instantiated only if needed.</b></p>
<h1>Further Reading</h1>
<p><a target="_blank" href="http://blog.extjs.eu/know-how/writing-a-big-application-in-ext">Writing a Big Application in Ext</a><br />
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><div class="paypal-donations"><input type="hidden" name="cmd" value="_donations" /><input type="hidden" name="business" value="js02@aariadne.com" /><input type="hidden" name="item_number" value="Blog Donation" /><input type="hidden" name="currency_code" value="EUR" /><input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif" name="submit" alt="PayPal - The safer, easier way to pay online." /><img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /></div></form></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.extjs.eu/know-how/xtype-defined/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Designing a 3 columns web page using TableLayout</title>
		<link>http://blog.extjs.eu/know-how/designing-a-3-columns-web-page-using-tablelayout/</link>
		<comments>http://blog.extjs.eu/know-how/designing-a-3-columns-web-page-using-tablelayout/#comments</comments>
		<pubDate>Fri, 04 Apr 2008 22:26:48 +0000</pubDate>
		<dc:creator>Saki</dc:creator>
				<category><![CDATA[Know-how]]></category>
		<category><![CDATA[column]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[extjs]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[table]]></category>

		<guid isPermaLink="false">http://blog.extjs.eu/?p=21</guid>
		<description><![CDATA[<br/>See also:  Simplest 3 Columns Layout with CSS
Design Goals
I have decided to re-design my webpage because I used some nested floating divs and I started to lose track of the hierarchy and css rules assigned to them. The design goals were:

Fixed width content area always displayed centered in the browser window
Fixed width columns: left [...]]]></description>
			<content:encoded><![CDATA[<br/><p>See also: <b><a href="http://blog.extjs.eu/know-how/simplest-3-columns-layout-with-css" rel="nofollow"> Simplest 3 Columns Layout with CSS</a></b></p>
<h1>Design Goals</h1>
<p>I have decided to re-design my webpage because I used some nested floating divs and I started to lose track of the hierarchy and css rules assigned to them. The design goals were:</p>
<ul>
<li>Fixed width content area always displayed centered in the browser window</li>
<li>Fixed width columns: left for navigation, center for content and right for AdSense</li>
<li>Standard 5 regions: north, west, center, east and south (not used yet)</li>
<li>Use Ext as much as possible</li>
<li>Keep css stylesheets as simple and straightforward as possible</li>
<li>Content generated by Ext</li>
<li>Cross-browser</li>
</ul>
<p><br/></p>
<h1>The Main Container</h1>
<p>Let&#8217;s create it as first parent of body:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;ct&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span></pre></div></div>

<p>and css:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#ct</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1020px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>So far so good, this works fine in all major browser but not, as usually, in Internet Explorer. Therefore, we need one more css rule that can create some minor problems we will have to solve later such as combo box dropdown list will be center aligned. Anyway, I haven&#8217;t found any better way for IE.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* not needed if you use a strict doctype */</span>
body <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><span style="color:#004488;"><b>Update</b>: I have meanwhile found that IE supports auto margins the expected way in strict mode. On the other hand, Jack Slocum advocates against using a doctype as it can trigger IE bugs resulting in rendering problems.</span></p>
<p><span style="color:#004488;">Now, it is up to you if you align body text to center and then you need to fix many Ext classes that inherits this rule from body or you use a strict doctype and you will risk the IE mis-behavior.</span></p>
<p><span style="color:#004488;">I have chosen to use the xhtml 1.0 strict doctype. Do not use the above text-align:center body rule if you use a strict doctype.</span></p>
<p><br/></p>
<h1>Ext Layout</h1>
<p>I needed north, west, center, east and south so first idea was to use BorderLayout rendered to <em>ct</em> and with <em>autoHeight:true</em>. After some trials and errors I found out that BorderLayout is not usable for this purpose so I&#8217;ve switched to <b>TableLayout</b>. </p>
<p>Now, the outermost container is Ext.Panel with TableLayout configured like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> layoutPanel <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Ext.<span style="color: #660066;">Panel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
     id<span style="color: #339933;">:</span><span style="color: #3366CC;">'main-layout'</span>
    <span style="color: #339933;">,</span>layout<span style="color: #339933;">:</span><span style="color: #3366CC;">'table'</span>
    <span style="color: #339933;">,</span>layoutConfig<span style="color: #339933;">:</span><span style="color: #009900;">&#123;</span>columns<span style="color: #339933;">:</span> <span style="color: #CC0000;">3</span><span style="color: #009900;">&#125;</span>
    <span style="color: #339933;">,</span>defaults<span style="color: #339933;">:</span><span style="color: #009900;">&#123;</span>border<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#125;</span>
    <span style="color: #339933;">,</span>items<span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#123;</span>
    	 id<span style="color: #339933;">:</span><span style="color: #3366CC;">'north'</span>
    	<span style="color: #339933;">,</span>colspan<span style="color: #339933;">:</span><span style="color: #CC0000;">3</span>
    	<span style="color: #339933;">,</span>cellCls<span style="color: #339933;">:</span><span style="color: #3366CC;">'td-north'</span>
    	<span style="color: #339933;">,</span>border<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">false</span>
    	<span style="color: #339933;">,</span>contentEl<span style="color: #339933;">:</span><span style="color: #3366CC;">'north-content'</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
    	 id<span style="color: #339933;">:</span><span style="color: #3366CC;">'west'</span>
    	<span style="color: #339933;">,</span>cellCls<span style="color: #339933;">:</span><span style="color: #3366CC;">'td-west'</span>
    	<span style="color: #339933;">,</span>border<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">false</span>
    	<span style="color: #339933;">,</span>contentEl<span style="color: #339933;">:</span><span style="color: #3366CC;">'west-content'</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
    	 id<span style="color: #339933;">:</span><span style="color: #3366CC;">'center'</span>
    	<span style="color: #339933;">,</span>cellCls<span style="color: #339933;">:</span><span style="color: #3366CC;">'td-center'</span>
    	<span style="color: #339933;">,</span>border<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">false</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
     	 id<span style="color: #339933;">:</span><span style="color: #3366CC;">'east'</span>
    	<span style="color: #339933;">,</span>cellCls<span style="color: #339933;">:</span><span style="color: #3366CC;">'td-east'</span>
    	<span style="color: #339933;">,</span>border<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">false</span>
    	<span style="color: #339933;">,</span>contentEl<span style="color: #339933;">:</span><span style="color: #3366CC;">'adsense'</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
    	 id<span style="color: #339933;">:</span><span style="color: #3366CC;">'south'</span>
    	<span style="color: #339933;">,</span>colspan<span style="color: #339933;">:</span><span style="color: #CC0000;">3</span>
    	<span style="color: #339933;">,</span>cellCls<span style="color: #339933;">:</span><span style="color: #3366CC;">'td-south'</span>
    	<span style="color: #339933;">,</span>border<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">false</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><br/></p>
<h1>Content Elements</h1>
<p>Some page content is statical, written in HTML markup so I have used <em>contentEl:&#8217;div-id&#8217;</em> to put it to right place (cell) of the layout. I already have divs with ids: north-content, west-content and adsense.</p>
<p>Some stylesheets are needed too at this point, keeping in mind that <em>cellCls</em> is assigned to the table cells (tds) and that table does not fill 100% of the container by default. This css hadles it:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* not needed if you use a strict doctype */</span>
body <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#ct</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1020px</span><span style="color: #00AA00;">;</span>
  <span style="color: #808080; font-style: italic;">/* not needed if you use a strict doctype */</span>
  <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#main-layout</span> table <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.td-north</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">90px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.td-west</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">190px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">vertical-align</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.td-center</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">700px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">vertical-align</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.td-east</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">vertical-align</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.td-south</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><br/></p>
<h1>Conclusion</h1>
<p>Finally, it is easy. I have all design goals in and if I need to render anything to, let&#8217;s say center, I just grab a reference to the panel&#8217;s body and render to it. For example:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Ext.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'center'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">body</span>.<span style="color: #660066;">update</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Center Content'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>or whatever else. If I need to put a static content in it I write it to a container and I&#8217;ll use <em>contentEl</em> as I did for <em>north</em> and <em>east</em>.</p>
<p>And the result is: <a href="http://extjs.eu">http://extjs.eu<a>. I like it!</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><div class="paypal-donations"><input type="hidden" name="cmd" value="_donations" /><input type="hidden" name="business" value="js02@aariadne.com" /><input type="hidden" name="item_number" value="Blog Donation" /><input type="hidden" name="currency_code" value="EUR" /><input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif" name="submit" alt="PayPal - The safer, easier way to pay online." /><img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /></div></form>
]]></content:encoded>
			<wfw:commentRss>http://blog.extjs.eu/know-how/designing-a-3-columns-web-page-using-tablelayout/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
