<?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 &#187; Ext JS</title>
	<atom:link href="http://iamtotti.com/blog/category/ext-js-javascript/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>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>11</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>ExtJS : 2 secs with custom vType</title>
		<link>http://iamtotti.com/blog/2009/12/extjs-2-secs-with-vtype/</link>
		<comments>http://iamtotti.com/blog/2009/12/extjs-2-secs-with-vtype/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 17:54:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ext JS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Regex]]></category>
		<category><![CDATA[vType]]></category>

		<guid isPermaLink="false">http://iamtotti.com/blog/?p=95</guid>
		<description><![CDATA[Following another question on ExtJS forum, I&#8217;ve created a sample of how to use vType for ExtJS newbies. Basically, in form submission you need to validate user input and / or prevent user from entering invalid keys. Pure Javascript implementation could be quite a headache to some folks. ExtJS now provides a regex-based validation class [...]]]></description>
			<content:encoded><![CDATA[<p>Following another question on ExtJS forum, I&#8217;ve created a sample of how to use vType for ExtJS newbies.</p>
<p>Basically, in form submission you need to validate user input and / or prevent user from entering invalid keys. Pure Javascript implementation could be quite a headache to some folks. ExtJS now provides a regex-based validation class called, vType, which helps you to do both things mentioned above.</p>
<p>Demo:<a href="http://iamtotti.com/playground/js/ext-3.1.0/playground/vtype.html"> a simple Custom vType</a><br />
<span id="more-95"></span><br />
You can find more examples at <a href="http://www.extjs.com/deploy/dev/docs/?class=Ext.form.VTypes" target="_blank">ExtJS 3.1 API: vType<br />
</a></p>
<p>vType.js</p>
<pre class="brush: jscript;">
&lt;pre&gt;
Ext.onReady(function(){
	// QuickTips to display error messages next to form fields
	Ext.QuickTips.init();

	// Declare a custom VType
	Ext.apply(Ext.form.VTypes, {
                 // This function validates input text
		AlphaNum:  function(v) {
			return /^[a-z0-9]$/i.test(v);
		},
                // This is the tooltip message displayed when invalid input occurs
		AlphaNumText: 'Must be an alphanumeric word',
                // This mask filter invalid keystrokes
		AlphaNumMask: /[a-z0-9]/i
	});

	// Simple form with a text field for demo purpose
	var myForm = new Ext.FormPanel({
		width: 300,
		renderTo: Ext.getBody(),
		title: '2 secs with vType Demo',
		items: [
			{
				xtype: 'textfield',
				id: 'alphanum',
				fieldLabel: 'AlphaNum',
				vtype: 'AlphaNum'
			}
		],
		buttons: [
			{
				text: 'Submit',
				handler: function() {
					// myForm.getForm().submit();
					Ext.Msg.alert('Action', 'Form submitted');
				}
			}, {
				text: 'Reset',
				handler: function() {
					myForm.getForm().reset();
				}
			}
		]
	});
});
&lt;/pre&gt;
</pre>
<p>vType.html</p>
<pre class="brush: xml;">
&lt;html&gt;
&lt;head&gt;
	&lt;title&gt;ExtJS - VTypes&lt;/title&gt;
	&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;../resources/css/ext-all.css&quot; /&gt;
	&lt;script src=&quot;../adapter/ext/ext-base.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
	&lt;script src=&quot;../ext-all.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;

	&lt;script src=&quot;js/vtype.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>You need to know a little bit of javascript regular expression in order to configure vType as you want.</p>
<p>Happy coding,</p>
<p>Totti</p>
]]></content:encoded>
			<wfw:commentRss>http://iamtotti.com/blog/2009/12/extjs-2-secs-with-vtype/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ext JS Examples: Drag n&#8217; Drop buttons on a panel</title>
		<link>http://iamtotti.com/blog/2009/12/ext-js-drag-n-drop-buttons-on-a-panel/</link>
		<comments>http://iamtotti.com/blog/2009/12/ext-js-drag-n-drop-buttons-on-a-panel/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 20:17:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ext JS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Drag n' Drop]]></category>
		<category><![CDATA[examples]]></category>

		<guid isPermaLink="false">http://iamtotti.com/blog/?p=42</guid>
		<description><![CDATA[This blog entry was written following a question of an user in ExtJS forum: How to drag n&#8217; drop a button on a panel ? ExtJs people tend to just focus on the grid-to-grid, grid-to-listview.. sort of drag and drop, and forgot to include in their documentation a typical example of &#8216;drag and drop&#8217; of [...]]]></description>
			<content:encoded><![CDATA[<p>This blog entry was written following a question of an user in ExtJS forum: <em>How to drag n&#8217; drop a button on a panel ?</em></p>
<p>ExtJs people tend to just focus on the grid-to-grid, grid-to-listview.. sort of drag and drop, and forgot to include in their documentation a typical example of &#8216;drag and drop&#8217; of a simple element like <em>a button on a panel</em>. Below is my implementation:</p>
<p>ExtJS: 3.x</p>
<p>Demo:<a href="http://iamtotti.com/playground/js/ext-3.1.0/playground/dd_button.html" target="_blank"> Drag and Drop a button</a></p>
<p><span id="more-42"></span>index.html</p>
<pre class="brush:html">&lt;html&gt;
&lt;head&gt;
	&lt;title&gt;ExtJS - Drag n' Drop Demo&lt;/title&gt;
	&lt;link rel="stylesheet" type="text/css" href="../resources/css/ext-all.css" /&gt;
	&lt;script src="js/ext-base.js" type="text/javascript"&gt;&lt;/script&gt;
	&lt;script src="js/ext-all.js" type="text/javascript"&gt;&lt;/script&gt;

	&lt;script src="js/dd_button.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
	&lt;div id="canvas"&gt;
	&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>dd_button.js</p>
<pre class="brush:js">Ext.onReady(function(){

	// Make the button Draggable inside  tag
	var initDragZone = function(v) {

		v.dragZone = new Ext.dd.DragZone(Ext.getBody(), {
			getDragData: function(e) {
				// .button-draggable == class of the button you want to drag around
				if(sourceEl = e.getTarget('.button-draggable')) {
					d = sourceEl.cloneNode(true);
					d.id = Ext.id();
					return v.dragData = {
						sourceEl: sourceEl,
						repairXY: Ext.fly(sourceEl).getXY(),
						ddel: d
					}
				}
			},

			onDrag: function(e) {
				// !Important: manually fix the default position of Ext-generated proxy element
				// Uncomment these line to see the Ext issue
				var proxy = Ext.DomQuery.select('*', this.getDragEl());
				proxy[2].style.position = '';
			},

			getRepairXY: function() {
				return this.dragData.repairXY;
			}
		});
	};		

        // Make the panel droppable to the button
	var initDropZone = function(g) {
		g.dropZone = new Ext.dd.DropZone(g.body, {

			getTargetFromEvent: function(e) {
				return e.getTarget('#canvas');
			},

			onNodeOver : function(target, dd, e, data){
				return Ext.dd.DropZone.prototype.dropAllowed;
			},

			onNodeDrop : function(target, dd, e, data) {
				// !Important: We assign the dragged element to be set to new drop position
				if(dragEl = Ext.get(data.sourceEl)) {
					dragEl.setXY([e.getPageX(),e.getPageY()]);
				}

				return true;
			}	

		});
	};

        // Make the Panel Droppable
	var myPanel = new Ext.Panel({
		width: 500,
		height: 300,
		renderTo: 'canvas',
		bodyStyle: { background: 'yellow' },
		html: 'Drop your button here',
		listeners: {
			render: initDropZone
		}
	});		

	var myButton = new Ext.Button({
		width: 30,
		height: 20,
		cls: 'button-draggable',
		text: "Drag me",
		renderTo: Ext.getBody(),
		listeners: {
			render: initDragZone
		}
	});
});</pre>
<p>The important point of this implementation is the onDrag method</p>
<pre class="brush:js">onDrag: function(e) {
				// !Important: manually fix the default position of Ext-generated proxy element
				// Uncomment these line to see the Ext issue
				var proxy = Ext.DomQuery.select('*', this.getDragEl());
				proxy[2].style.position = '';
			},</pre>
<p>Try removing the function onDrag above, you&#8217;ll see this positioning issue:</p>
<p><img src="http://iamtotti.com/blog/wp-content/uploads/2009/12/dd_button.jpg" alt="Positioning Issue" width="100%" /></p>
<p>Have fun,</p>
<p>Totti</p>
]]></content:encoded>
			<wfw:commentRss>http://iamtotti.com/blog/2009/12/ext-js-drag-n-drop-buttons-on-a-panel/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
