<?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>VinylFox &#187; ExtJS Plugins</title>
	<atom:link href="http://www.vinylfox.com/category/extjs/plugins/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vinylfox.com</link>
	<description>The Playground of VinylFox (Shea Frederick)</description>
	<lastBuildDate>Thu, 29 Jul 2010 16:37:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Forwarding Mouse Events Through Layers</title>
		<link>http://www.vinylfox.com/forwarding-mouse-events-through-layers/</link>
		<comments>http://www.vinylfox.com/forwarding-mouse-events-through-layers/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 15:05:46 +0000</pubDate>
		<dc:creator>Shea Frederick</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[ExtJS Plugins]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[ExtJS Overrides]]></category>

		<guid isPermaLink="false">http://www.vinylfox.com/?p=499</guid>
		<description><![CDATA[Anyone who has worked with web apps has likely created a masking element at some point, and the great thing about a masking element is that it intercepts user interaction, letting us create a pseudo-modal user interface. The masking element enables us to mask the entire screen, bringing focus to a particular element, or just [...]]]></description>
			<content:encoded><![CDATA[<p>Anyone who has worked with web apps has likely created a masking element at some point, and the great thing about a masking element is that it intercepts user interaction, letting us create a pseudo-modal user interface. The masking element enables us to mask the entire screen, bringing focus to a particular element, or just create a window like effect. This behavior is demonstrated in the ExtJS libraries <em>Ext.Window</em> when <em>modal </em>is set to true, among other places.</p>
<h3>Yeah, so what?</h3>
<p><img src="http://www.vinylfox.com/wp-content/uploads/2009/09/layers-masked1.png" alt="layers-masked1" title="layers-masked1" width="250" height="163" class="alignright size-full wp-image-543" />The problem comes when we want to mask a part of the screen, but also want the elements behind that mask to continue responding to user interaction. This behavior is counter to most native behavior. What we are left with, is having to forward mouse events through the masking layer to the layer below, an option that simply does not exist in the standard JavaScript/DOM API.</p>
<h3>Why do this?</h3>
<p>A plugin that I recently wrote &#8211; <a href="http://code.google.com/p/ext-ux-datadrop/" target="_blank">DataDrop </a>- used a <em>textarea </em>overlaying a grid to act as the receiver of dragged data from spreadsheet type programs. One of the limitations that I was not so happy about was the fact that this overlay could only exist in the &#8216;empty&#8217; area of the grid, not over rows of data, headers, toolbars, etc. otherwise it would cause all of those elements below to become unresponsive to user input. If our <em>textarea</em> that receives the data were positioned over the entire grid area, our <em>GridPanel</em> could not be controlled using the mouse anymore.</p>
<h3>How to fix this?</h3>
<p>This is where my friend Nige White (Animal) came in to help, it turns out that he had an idea about how to forward these mouse events using a couple of not well understood methods in the JavaScript/DOM API used for creating mouse events. Here are the steps taken:</p>
<ol>
<li>The <em>textarea </em> (my masking element) that is positioned over the grid receives <em>mouseover</em>, <em>mousemove</em>, <em>mousedown </em>, <em>mouseup </em> and other events.</li>
<li>The top masking layer is hidden for a moment, so we can figure out what element is below the mask at the event location.</li>
<li>The event is re-fired &#8211; this is where the <a href="http://www.w3.org/TR/DOM-Level-2-Events/ecma-script-binding.html" target="_blank">W3 DOM Event model</a> and the simpler <a href="http://msdn.microsoft.com/en-us/library/ms536423(VS.85).aspx" target="_blank">Microsoft equivalent</a> come into play.</li>
<li>Start the process again &#8211; ready for the next event.</li>
</ol>
<p><img src="http://www.vinylfox.com/wp-content/uploads/2009/09/layers-steps1.png" alt="layers-steps1" title="layers-steps1" width="500" height="326" class="alignright size-full wp-image-557" /></p>
<h3>What&#8217;s element to fire upon?</h3>
<p>Knowing the cursor position and event that occurred, the only obstacle now is determining what DOM element to fire the simulated event through. It turns out that finding which element is the topmost element at a certain document coordinate position is quite simple in modern browsers. The <b>document.elementFromPoint</b> method is supported in <a href="http://msdn.microsoft.com/en-us/library/ms536417(VS.85).aspx" target="_blank">IE</a>, <a href="https://developer.mozilla.org/en/DOM/document.elementFromPoint" target="_blank">Mozilla</a>, Webkit and Opera.</p>
<p>So it is possible to capture the document coordinates of a mouse event fired on the masking element, momentarily hide that masking element, and then ask the document what is under that coordinate position before showing the mask again.</p>
<p>A new event can be then fired on the found element. Obviously there are some complexities such as firing <em>mouseover </em>and <em>mouseout </em>events when the found element is different from the last time, but that is the gist of the technique. To <a href="http://screencast.com/t/4bZevAUwEuj" target="_blank">see it in action, check out the screencast</a> or play with the <a href="http://www.vinylfox.com/lib/latest/examples/grid/array-grid-datadrop.html" target="_blank">live Grid DataDrop example</a> or <a href="http://www.vinylfox.com/lib/latest/examples/core/evt-forwarding.html" target="_blank">simple DOM element example</a> yourself.</p>
<p>I have posted an <a href="http://code.google.com/p/ext-ux-datadrop/source/browse/trunk/src/Override.js"target="_blank">override of Ext.Element that Nigel created</a> on my Google Code site for all to enjoy, it is now a requirement for the ExtJS <a href="http://code.google.com/p/ext-ux-datadrop/"target="_blank">DataDrop plugin</a>. A big thanks goes out to Nige (Animal) for digging into the nuts and bolts of JavaScript to find a solution to my problem.</p>
<h3>The Next Step</h3>
<p>Having the data that is dropped into the grid automatically insert into the grids rows at the correct position is my next task for the ever-improving <a href="http://code.google.com/p/ext-ux-datadrop/"target="_blank">DataDrop plugin</a>. Should be fun :/</p>
<p>UPDATE (12-1-09): Seems that <a href="http://hacks.mozilla.org/2009/12/pointer-events-for-html-in-firefox-3-6/">Mozilla has also noticed this issue</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vinylfox.com/forwarding-mouse-events-through-layers/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>HtmlEditor Plugin Updates &amp; Fixes</title>
		<link>http://www.vinylfox.com/htmleditor-plugin-updates-fixes/</link>
		<comments>http://www.vinylfox.com/htmleditor-plugin-updates-fixes/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 13:53:24 +0000</pubDate>
		<dc:creator>Shea Frederick</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[ExtJS Plugins]]></category>
		<category><![CDATA[HtmlEditor]]></category>

		<guid isPermaLink="false">http://www.vinylfox.com/?p=496</guid>
		<description><![CDATA[I had the opportunity recently to watch end users interact with my set of ExtJS HtmlEditor Plugins, which brought to my attention some shortcomings with the UI that have now been addressed. Read about the updates below, or go directly to get the updated HtmlEditor Plugins code. Word Paste The most exciting change is to [...]]]></description>
			<content:encoded><![CDATA[<p>I had the opportunity recently to watch end users interact with my set of ExtJS HtmlEditor Plugins, which brought to my attention some shortcomings with the UI that have now been addressed. Read about the updates below, or go directly to <a href="http://code.google.com/p/ext-ux-htmleditor-plugins/">get the updated HtmlEditor Plugins code.</a></p>
<h2>Word Paste</h2>
<p><img alt="" src="http://content.screencast.com/users/VinylFox/folders/Jing/media/8f704239-067c-4884-ab6d-60ec5145a6ee/2009-09-16_0913.png" title="Word Paste" class="alignright" width="127" height="99" style="border: 1px solid rgb(0, 0, 0); margin: 0px 0px 10px 10px;" />The most exciting change is to how the Word Paste plugin works, which now captures a paste event and can fix the Word garbage without any user interaction. The old UI has been ditched, and replaced with a single toggle button on the HtmlEditor toolbar which turns the functionality on or off. No pop-up window needed.</p>
<h2>Form Validation</h2>
<p><img alt="" src="http://content.screencast.com/users/VinylFox/folders/Jing/media/89922df3-af48-4903-b42c-de17d05e9193/2009-09-16_0925.png" title="Form Validation" class="alignright" width="143" height="97" style="border: 1px solid rgb(0, 0, 0); margin: 0px 0px 10px 10px;" />All of the forms used for inserting now validate their input before allowing the user to insert anything. When the user fills out the form invalidly, they get a squiggly red line (like that of a misspelling in Word). If they try to submit the form with the field still invalid, a &#8220;frame&#8221; animation effect brings their attention to the invalid field.</p>
<h2>Context Activation</h2>
<p>Two new features were added that allow the buttons to be enabled or disabled based on text selection, and what tags are present in the selected text or cursor position. This simply means, for example, that the &#8216;Bold&#8217; button will be toggled if the selected text, or cursor position has a bold tag in it. To use this feature we just need to enable it.</p>
<p><textarea class="js" cols="100" name="code">Ext.ux.form.HtmlEditor.Bold = Ext.extend(Ext.ux.form.HtmlEditor.MidasCommand, {<br />
    midasBtns: [{<br />
        monitorCmdState: true,<br />
        cmd: 'bold',<br />
        title: 'Bold'<br />
    }]<br />
});</textarea></p>
<p>The second part of this feature set is enabling or disabling a button on text selection, this is used in the <i>Remove Formatting</i> button because it would be silly to have this button enabled if no text was selected.</p>
<ul>
<li>enableOnSelection &#8211; set to true to enable button only when text is selected.</li>
<li>disableOnSelection &#8211; set to true to disable button only when text is selected.</li>
</ul>
<p>See how the <i>Remove Formatting</i> button takes advantage of this feature.</p>
<p><textarea class="js" cols="100" name="code">Ext.ux.form.HtmlEditor.RemoveFormat = Ext.extend(Ext.ux.form.HtmlEditor.MidasCommand, {<br />
    midasBtns: ['|',{<br />
        enableOnSelection: true,<br />
        cmd: 'removeFormat',<br />
        title: 'Remove Formatting'<br />
    }]<br />
});</textarea></p>
<h2>Overflow Text</h2>
<p><img alt="" src="http://content.screencast.com/users/VinylFox/folders/Jing/media/916561a4-a110-49e0-a9f4-043f17a196f8/2009-09-16_0929.png" title="Overflow Text" class="alignright" width="184" height="108" style="border: 1px solid rgb(0, 0, 0); margin: 0px 0px 10px 10px;" />The overflow text used when a toolbar has too many buttons to fit in the width has been added. This was overlooked on my first version of this plugin. Thanks to &#8216;feyyaz&#8217; from the ExtJS forums for spotting this.</p>
<h2>Conclusion</h2>
<p>Hopefully these new features and fixes will prove useful to everyone, and as always, feedback is the only way this plugin set is going to get better, so keep the suggestions coming. Now its time for me to go get some breakfast and a large(ish) cup of coffee. Enjoy!</p>
<p><a href="http://code.google.com/p/ext-ux-htmleditor-plugins/">HtmlEditor Plugins Code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.vinylfox.com/htmleditor-plugin-updates-fixes/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>DataDrop &#8211; Drag Grid Data in From a Spreadsheet</title>
		<link>http://www.vinylfox.com/datadrop-drag-grid-data-from-spreadsheet/</link>
		<comments>http://www.vinylfox.com/datadrop-drag-grid-data-from-spreadsheet/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 20:12:44 +0000</pubDate>
		<dc:creator>Shea Frederick</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[ExtJS Plugins]]></category>
		<category><![CDATA[Grid]]></category>
		<category><![CDATA[Spreadsheet]]></category>

		<guid isPermaLink="false">http://www.vinylfox.com/?p=473</guid>
		<description><![CDATA[I was stewing about an example that Andrea Giammarchi came up with, it was so cool &#8211; very cool &#8211; but totally useless in the form it was in (from a UX standpoint). It was a proof of concept, so I wasn&#8217;t expecting it to be useful right away, in fact all I was expecting [...]]]></description>
			<content:encoded><![CDATA[<p>I was stewing about an example that <a href="http://webreflection.blogspot.com/" target="_blank">Andrea Giammarchi</a> came up with, it was so cool &#8211; very cool &#8211; but totally useless in the form it was in (from a UX standpoint). It was a proof of concept, so I wasn&#8217;t expecting it to be useful right away, in fact all I was expecting is that it give me an idea &#8211; and it did.</p>
<h2>The Concept</h2>
<p>If we could drag our tabular data into grids from other programs we could circumvent the need to upload a data file to a web server to be read and parsed, then spit back out to our browser in a readable format. Anyone who has ever had to parse Excel files on the server side knows how much of a pain it is, we might be lucky if we get a CSV file or some other simple format, but in the real world the end user running their spreadsheet program has no clue what simple tabular data is.</p>
<p>Using the same concept from Andrea&#8217;s example page, we can create a zone within the grid which will accept dragged data from a spreadsheet. The behavior that we are taking advantage of is the way in which an html textarea will accept dragged data from a spreadsheet and format it as tab delimited data.</p>
<h2>The Plugin</h2>
<p>My first version of the plugin is rough around the edges, but works in all browsers (minus Opera) very reliably. Being a plugin, the usage is straight forward, there are no configuration values that need to be defined at this time.</p>
<p><textarea class="js" cols="100" name="code">{<br />
	xtype: &#8216;grid&#8217;,<br />
	&#8230;,<br />
	plugins: [Ext.ux.grid.DataDrop],<br />
	&#8230;<br />
}</textarea></p>
<p>Check out the screencast below to see it in action &#8211; I am dragging rows of data from OpenOffice Calc directly to an ExtJS Grid.</p>
<p><object class="embeddedObject" classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" width="650" height="638"><param name="movie" value="http://content.screencast.com/users/VinylFox/folders/Jing/media/a27e44bc-8901-4c9e-8e4d-cbae429baf5b/jingswfplayer.swf"></param><param name="quality" value="high"></param><param name="bgcolor" value="#FFFFFF"></param><param name="flashVars" value="containerwidth=650&#038;containerheight=638&#038;thumb=http://content.screencast.com/users/VinylFox/folders/Jing/media/a27e44bc-8901-4c9e-8e4d-cbae429baf5b/FirstFrame.jpg&#038;loaderstyle=jing&#038;content=http://content.screencast.com/users/VinylFox/folders/Jing/media/a27e44bc-8901-4c9e-8e4d-cbae429baf5b/2009-09-03_1236.swf&#038;blurover=false"></param><param name="allowFullScreen" value="true"></param><param name="scale" value="showall"></param><param name="allowScriptAccess" value="always"></param><param name="base" value="http://content.screencast.com/users/VinylFox/folders/Jing/media/1df86ee9-458e-474f-9e6f-b6f63ff37eba/"></param><embed class="embeddedObject" src="http://content.screencast.com/users/VinylFox/folders/Jing/media/a27e44bc-8901-4c9e-8e4d-cbae429baf5b/jingswfplayer.swf" quality="high" bgcolor="#FFFFFF" width="650" height="638" type="application/x-shockwave-flash" allowScriptAccess="always" flashVars="containerwidth=650&#038;containerheight=638&#038;thumb=http://content.screencast.com/users/VinylFox/folders/Jing/media/a27e44bc-8901-4c9e-8e4d-cbae429baf5b/FirstFrame.jpg&#038;loaderstyle=jing&#038;content=http://content.screencast.com/users/VinylFox/folders/Jing/media/a27e44bc-8901-4c9e-8e4d-cbae429baf5b/2009-09-03_1236.swf&#038;blurover=false" allowFullScreen="true" base="http://content.screencast.com/users/VinylFox/folders/Jing/media/1df86ee9-458e-474f-9e6f-b6f63ff37eba/" scale="showall"></embed></object></p>
<h2>The Code</h2>
<p>As always, I have setup a <a href="http://code.google.com/p/ext-ux-datadrop/" target="_blank">Google code</a> site for this. Please <a href="http://code.google.com/p/ext-ux-datadrop/source/browse/trunk/src/" target="_blank">browse the source</a> to get the plugin code. I don&#8217;t have an example page, but the <a href="/docs/?class=Ext.ux.grid.DataDrop" target="_blank">documentation is online</a></p>
<p><a href="http://code.google.com/p/ext-ux-datadrop/source/browse/trunk/src/Ext.ux.DataDrop.js" target="_blank">Ext.ux.DataDrop.js</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.vinylfox.com/datadrop-drag-grid-data-from-spreadsheet/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>Plugin set for HtmlEditor gets a CharacterMap</title>
		<link>http://www.vinylfox.com/plugin-set-for-htmleditor-gets-a-charactermap/</link>
		<comments>http://www.vinylfox.com/plugin-set-for-htmleditor-gets-a-charactermap/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 14:26:10 +0000</pubDate>
		<dc:creator>Shea Frederick</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[ExtJS Plugins]]></category>
		<category><![CDATA[HtmlEditor]]></category>

		<guid isPermaLink="false">http://www.vinylfox.com/?p=410</guid>
		<description><![CDATA[Over time I will be adding more and more of these HtmlEditor plugins in an effort to turn the ExtJS HtmlEditor into a lean mean fighting machine! My goal is to give the ExtJS HtmlEditor all the power of those other rich text editors but without the overhead. The obvious next choice for a button [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.vinylfox.com/wp-content/uploads/2009/07/charmap-300x170.png" alt="charmap" title="charmap" width="300" height="170" class="alignleft size-full wp-image-413" align="left" style="margin: 10px 10px 10px 0; border: solid 1px #000;"/>Over time I will be adding more and more of these HtmlEditor plugins in an effort to turn the ExtJS HtmlEditor into a lean mean fighting machine! My goal is to give the ExtJS HtmlEditor all the power of those other rich text editors but without the overhead.</p>
<p>The obvious next choice for a button was to add a character map which allows the user to insert special characters.</p>
<h2>How it Works</h2>
<p>The character map is just a <em>DataView</em> in a window which allows selection of each item. By double clicking on an item, a single character can be inserted or we can select a single item or multiple items using the ctrl or shift keys and click the &#8216;Insert&#8217; button.</p>
<h2>Using it</h2>
<p>Just like the <a href="http://www.vinylfox.com/plugin-set-for-additional-extjs-htmleditor-buttons/">other plugins in this set</a>, it can be added to the plugins array of your HtmlEditor.</p>
<p><textarea class="js" cols="100" name="code">{<br />
	xtype: &#8216;htmleditor&#8217;,<br />
	&#8230;,<br />
	plugins: [new Ext.ux.form.HtmlEditor.SpecialCharacters()],<br />
	&#8230;<br />
}</textarea></p>
<p>I also created a couple of configs that allow you to specify which characters you want displayed, along with any additional characters. Both of the following configs use the numeric portion of the ASCII HTML Character Code only &#8211; for example, to use the Copyright symbol, which is <strong>&#38;#169;</strong> we would just specify <strong>169</strong> in the config.</p>
<p>If we wanted to only display a subset of characters, we would set the value of the <em>charRange </em>config to an array containing the starting and ending points of the characters we wanted.</p>
<p><textarea class="js" cols="100" name="code">{<br />
	xtype: &#8216;htmleditor&#8217;,<br />
	&#8230;,<br />
	plugins: [new Ext.ux.form.HtmlEditor.SpecialCharacters({<br />
		charRange: [192,256] // Accented characters only<br />
	})],<br />
	&#8230;<br />
}</textarea></p>
<p>There is also the option to include additional characters using the <em>specialChars </em>config, providing an array of the characters.</p>
<p><textarea class="js" cols="100" name="code">{<br />
	xtype: &#8216;htmleditor&#8217;,<br />
	&#8230;,<br />
	plugins: [new Ext.ux.form.HtmlEditor.SpecialCharacters({<br />
		specialChars: [42,43,45,47,60,61,62] // Math operator characters<br />
	})],<br />
	&#8230;<br />
}</textarea></p>
<h2>Enjoy!</h2>
<p>As always, please enjoy this plugin and feel free to use it wherever you want. Feedback is very appreciated.</p>
<p>Source available on Google Code: <a href="http://code.google.com/p/ext-ux-htmleditor-plugins/">http://code.google.com/p/ext-ux-htmleditor-plugins/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.vinylfox.com/plugin-set-for-htmleditor-gets-a-charactermap/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SelectionEnabler Plugin for ExtJS</title>
		<link>http://www.vinylfox.com/selectionenabler-plugin-for-extjs/</link>
		<comments>http://www.vinylfox.com/selectionenabler-plugin-for-extjs/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 14:46:47 +0000</pubDate>
		<dc:creator>Shea Frederick</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[ExtJS News]]></category>
		<category><![CDATA[ExtJS Plugins]]></category>

		<guid isPermaLink="false">http://www.vinylfox.com/?p=338</guid>
		<description><![CDATA[I recently found myself writing the same bit of code for the one-millionth time, and that&#8217;s when it hit me: &#8220;this could easily be a plugin&#8221;. The code in question is quite simple, but just enough lines to warrant some thought about how to make it simpler (read as: make my fingers type less). It [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.vinylfox.com/wp-content/uploads/2009/07/untitled-3-150x150.png" alt="selectionenabler-plugin" title="selectionenabler-plugin" width="150" height="150" class="alignleft size-full wp-image-350" align="left" style="margin: 10px; border: solid 1px #000;"/>I recently found myself writing the same bit of code for the one-millionth time, and that&#8217;s when it hit me: &#8220;this could easily be a plugin&#8221;.</p>
<p>The code in question is quite simple, but just enough lines to warrant some thought about how to make it simpler (read as: make my fingers type less). It disables <em>Components </em>based upon the <em>SelectionModel </em>of another component. With a plugin, we can attach events to the selection model automagically through our plugin, and run a chunk of code that would look around for related <em>Components </em>that need to be enabled or disabled. Setting a special config in each <em>Component </em>that you wish to disable or enable will determine what happens to that <em>Component</em>.</p>
<h2>The SelectionEnabler</h2>
<p>Lets say we have a grid, and we want to disable or enable the infamous &#8220;Delete&#8221; button, we would first add this plugin, and since this plugin works around the idea of having groups of <em>Components </em>to enable or disable we will tell it what &#8216;group&#8217; to look for &#8211; in this case its &#8216;deletegrid&#8217;.</p>
<p><textarea class="js" cols="100" name="code">{<br />
	xtype: &#8216;grid&#8217;,<br />
	&#8230;,<br />
	plugins: [new Ext.ux.SelectionEnabler({enablerGroup: 'deletegrid'})],<br />
	&#8230;<br />
}</textarea></p>
<p>What this does is tell our grid that it should look for <em>Components </em>in that same group when a selection has been made, and disable or enable them accordingly. The next part of this process is to add the <em>Components </em>that we actually want to be disabled and enabled.</p>
<h2>Welcome to &#8220;Delete&#8221;</h2>
<p>As the <em>SelectionEnabler </em>plugin gets the message that a selection has changed, it searches within the layout of the current <em>Component </em>for other <em>Components </em>with the <i>enableOnSinge</i> or <i>enableOnMultiple</i> configs set, and if the group name matches, it enables or disables that <em>Component </em>appropriately. Here we have a button with <i>enableOnSingle</i> set to &#8216;deletegrid&#8217; which will enable the button when a single selection is made, but disable it for multiple or no selection.</p>
<p><textarea class="js" cols="100" name="code">{<br />
	xtype: &#8216;grid&#8217;,<br />
	&#8230;,<br />
	plugins: [new Ext.ux.SelectionEnabler({enablerGroup: 'deletegrid'})],<br />
	&#8230;<br />
	bbar: [{<br />
		text: 'Single',<br />
		enableOnSingle: 'deletegrid',<br />
		disabled: true,<br />
		handler: deleteRow<br />
	}]<br />
}</textarea></p>
<p>That is all that needs to happen for an ExtJS <em>Component </em>(a Button in this case) to be disabled or enabled upon selection. This same method can be used to disable any type of Component, such as Panels, form fields, etc. Currently it works with Grid and Tree selection models (both multiple and single selections) and can enable or disable any component existing in the same layout that has a disable/enable handler.</p>
<h2>Screencast Demo</h2>
<p>Sometimes a picture (or video) just says it all, so I took this screencast of some simple example uses, which are also included in the code repo.</p>
<p><object class="embeddedObject" classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" width="652" height="438"><param name="movie" value="http://content.screencast.com/users/VinylFox/folders/Jing/media/1df86ee9-458e-474f-9e6f-b6f63ff37eba/jingswfplayer.swf"></param><param name="quality" value="high"></param><param name="bgcolor" value="#FFFFFF"></param><param name="flashVars" value="containerwidth=652&#038;containerheight=438&#038;thumb=http://content.screencast.com/users/VinylFox/folders/Jing/media/1df86ee9-458e-474f-9e6f-b6f63ff37eba/FirstFrame.jpg&#038;loaderstyle=jing&#038;content=http://content.screencast.com/users/VinylFox/folders/Jing/media/1df86ee9-458e-474f-9e6f-b6f63ff37eba/2009-07-07_1018.swf&#038;blurover=false"></param><param name="allowFullScreen" value="true"></param><param name="scale" value="showall"></param><param name="allowScriptAccess" value="always"></param><param name="base" value="http://content.screencast.com/users/VinylFox/folders/Jing/media/1df86ee9-458e-474f-9e6f-b6f63ff37eba/"></param><embed class="embeddedObject" src="http://content.screencast.com/users/VinylFox/folders/Jing/media/1df86ee9-458e-474f-9e6f-b6f63ff37eba/jingswfplayer.swf" quality="high" bgcolor="#FFFFFF" width="652" height="438" type="application/x-shockwave-flash" allowScriptAccess="always" flashVars="containerwidth=652&#038;containerheight=438&#038;thumb=http://content.screencast.com/users/VinylFox/folders/Jing/media/1df86ee9-458e-474f-9e6f-b6f63ff37eba/FirstFrame.jpg&#038;loaderstyle=jing&#038;content=http://content.screencast.com/users/VinylFox/folders/Jing/media/1df86ee9-458e-474f-9e6f-b6f63ff37eba/2009-07-07_1018.swf&#038;blurover=false" allowFullScreen="true" base="http://content.screencast.com/users/VinylFox/folders/Jing/media/1df86ee9-458e-474f-9e6f-b6f63ff37eba/" scale="showall"></embed></object>
</p>
<p>My next goal with this is to put some type of caching in place for this plugin so it will not be so resource intensive every time a selection change happens.</p>
<p><a href="http://code.google.com/p/ext-ux-selectionenabler/">http://code.google.com/p/ext-ux-selectionenabler/</a></p>
<p>&nbsp;</p>
<p>Additionally, I want to thank <a href="http://www.homeandstone.com">Home &#038; Stone</a> for allowing me to contribute this code back to the community, along with the previous release of the <a href="http://www.vinylfox.com/plugin-set-for-additional-extjs-htmleditor-buttons/">HtmlEditor buttons</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vinylfox.com/selectionenabler-plugin-for-extjs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Plugin set of additional ExtJS HtmlEditor Buttons</title>
		<link>http://www.vinylfox.com/plugin-set-for-additional-extjs-htmleditor-buttons/</link>
		<comments>http://www.vinylfox.com/plugin-set-for-additional-extjs-htmleditor-buttons/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 19:56:47 +0000</pubDate>
		<dc:creator>Shea Frederick</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[ExtJS News]]></category>
		<category><![CDATA[ExtJS Plugins]]></category>
		<category><![CDATA[HtmlEditor]]></category>

		<guid isPermaLink="false">http://www.vinylfox.com/?p=346</guid>
		<description><![CDATA[A couple of cups of coffee and a late night fueled by the hatred of the TinyMCE editor prompted me to write a set of Plugins extending the functionality of the ExtJS HtmlEditor. Home &#038; Stone asked me to integrate the TinyMCE editor into their application, so of course I said yes, knowing that I [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.vinylfox.com/wp-content/uploads/2009/06/htmleditor-plugin-set.png" alt="htmleditor-plugin-set" title="htmleditor-plugin-set" width="234" height="213" class="alignleft size-full wp-image-350" align="left" style="margin: 10px; border: solid 1px #000;"/>A couple of cups of coffee and a late night fueled by the hatred of the TinyMCE editor prompted me to write a set of Plugins extending the functionality of the ExtJS HtmlEditor.</p>
<p><a href="http://www.homeandstone.com">Home &#038; Stone</a> asked me to integrate the TinyMCE editor into their application, so of course I said yes, knowing that I had done this before and that it generally worked out just fine. Well, three or four days later (its all a blur) having written layers and layers of overrides to the TinyMCE editor, extended or overrode Ext.Panel, Ext.Window, Ext.Updater and so on. I finally said to myself &#8220;thats enough, this just isn&#8217;t worth it&#8221; &#8211; I can get this done faster and better using ExtJS the way it was meant to be used.</p>
<h2>The Outcome</h2>
<p>Out of my pain comes a set of plugins that start to mimic what TinyMCE provides, with way less overhead, both in file size and memory.</p>
<p>Currently, these are the plugins that have been created for this set:</p>
<ul>
<li>WordPaste</li>
<li>Divider</li>
<li>Table</li>
<li>HR</li>
<li>IndentOutdent</li>
<li>SubSuperScript</li>
<li>RemoveFormat</li>
<li>MidasCommand</li>
</ul>
<p>I have posted all of these in a new Google Code project, so feel free to use these in your projects and contribute back any fixes or upgrades you might have along the way.</p>
<p><a href="http://code.google.com/p/ext-ux-htmleditor-plugins/">http://code.google.com/p/ext-ux-htmleditor-plugins/</a></p>
<h2>How to Use Them</h2>
<p>First you will need to include the plugin files you want (<i>MidasCommand</i> will need to be included first), then set them up on the HtmlEditor as a Plugin like this:</p>
<p><textarea class="js" cols="100" name="code">{<br />
	fieldLabel: &#8216;Description&#8217;,<br />
	name: &#8216;description&#8217;,<br />
	value: &#8216;bwah bwah&#8217;,<br />
	anchor: &#8217;100%&#8217;,<br />
	xtype: &#8220;htmleditor&#8221;,<br />
	height: 400,<br />
	plugins: [<br />
		new Ext.ux.form.HtmlEditor.Word(),<br />
		new Ext.ux.form.HtmlEditor.Divider(),<br />
		new Ext.ux.form.HtmlEditor.Table(),<br />
		new Ext.ux.form.HtmlEditor.HR(),<br />
		new Ext.ux.form.HtmlEditor.IndentOutdent(),<br />
		new Ext.ux.form.HtmlEditor.SubSuperScript(),<br />
		new Ext.ux.form.HtmlEditor.RemoveFormat()<br />
	]<br />
}</textarea></p>
<p>Thats it! They show up in the toolbar in the order they are added. A Divider can be inserted at any point, and some have dividers built in.</p>
<h2>Make Your Own</h2>
<p>This whole process brought about the creation of a simple base class used for adding your own Midas commands &#8211; <i>Ext.ux.form.HtmlEditor.MidasCommand</i>. This class can be extended and provided a simple config that will create the buttons and their handlers for you.</p>
<p><textarea class="js" cols="100" name="code">Ext.ux.form.HtmlEditor.RemoveFormat = Ext.extend(Ext.ux.form.HtmlEditor.MidasCommand, {<br />
    midasBtns: ['|',{<br />
        cmd: 'removeFormat',<br />
        title: 'Remove Formatting'<br />
    }]<br />
});</textarea></p>
<p>PS: Im glad to see the trend towards Plugin use in ExtJS, allowing the addition of bits of functionality without conflicting with other functionality, and without having to resort to extending.</p>
<p>&nbsp;</p>
<p>Additionally, I want to thank <a href="http://www.homeandstone.com">Home &#038; Stone</a> for allowing me to contribute this code back to the community, they have expressed interest in giving back, so im sure we will see more of these types of things being released soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vinylfox.com/plugin-set-for-additional-extjs-htmleditor-buttons/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
	</channel>
</rss>
