<?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>Ola Bildtsen</title>
	<atom:link href="http://bildtsen.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://bildtsen.com</link>
	<description>Flex, Groovy/Grails, Ext JS, and other neat stuff</description>
	<lastBuildDate>Tue, 15 May 2012 15:43:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>ExtJS 4: Combobox with multiple auto-complete values</title>
		<link>http://bildtsen.com/2012/05/extjs-4-combobox-with-multiple-auto-complete-values/</link>
		<comments>http://bildtsen.com/2012/05/extjs-4-combobox-with-multiple-auto-complete-values/#comments</comments>
		<pubDate>Tue, 15 May 2012 15:43:45 +0000</pubDate>
		<dc:creator>Ola Bildtsen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://bildtsen.com/?p=214</guid>
		<description><![CDATA[I was looking for a simple way to have a text field that uses auto-complete and allows for multiple values. As an example, consider a text field that needs to hold several email addresses where each address is auto-completed. I ran across the Boxselect for ExtJS 4 implementation and gave that a whirl. Trouble is [...]]]></description>
			<content:encoded><![CDATA[<p>I was looking for a simple way to have a text field that uses auto-complete and allows for multiple values.  As an example, consider a text field that needs to hold several email addresses where each address is auto-completed.  I ran across the <a href="http://www.sencha.com/forum/showthread.php?139170-BoxSelect-for-Ext-4-another-implementation">Boxselect for ExtJS 4</a> implementation and gave that a whirl.  Trouble is it doesn&#8217;t allow for non-selected values (no free text) and it seemed like overkill for our purposes.  We just wanted a simple comma-separated list like in this <a href="http://jqueryui.com/demos/autocomplete/#multiple-remote">JQuery UI autocomplete example</a>.</p>
<p>Turns out it&#8217;s rather straight-forward to emulate the JQuery UI autocomplete example by simply handling some events from the ExtJS Combobox component.  We set up a Combobox in the view with a remote store, like so:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;">    <span style="color: #009900;">&#123;</span>
        xtype<span style="color: #339933;">:</span> <span style="color: #3366CC;">'combobox'</span><span style="color: #339933;">,</span>
        itemId<span style="color: #339933;">:</span> <span style="color: #3366CC;">'emails'</span><span style="color: #339933;">,</span>
        <span style="color: #000066;">name</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'emails'</span><span style="color: #339933;">,</span>
        minChars<span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span>
        store<span style="color: #339933;">:</span> <span style="color: #3366CC;">'EmailSuggestionStore'</span><span style="color: #339933;">,</span>
        displayField<span style="color: #339933;">:</span> <span style="color: #3366CC;">'email'</span><span style="color: #339933;">,</span>
        typeAhead<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
        queryMode<span style="color: #339933;">:</span> <span style="color: #3366CC;">'remote'</span><span style="color: #339933;">,</span>
        hideTrigger<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
        selectOnFocus<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
        emptyText<span style="color: #339933;">:</span> <span style="color: #3366CC;">'Add users<span style="color: #000099; font-weight: bold;">\'</span> email addresses here, separated by commas'</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Then we need to intercept some of the events that the Combobox fires, in order to make the multiple values work the way we want.  The controller code looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;">            <span style="color: #3366CC;">'myWindow #emails'</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #3366CC;">'change'</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>cmp<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span>cmp.<span style="color: #660066;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> cmp.<span style="color: #660066;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">length</span> <span style="color: #339933;">&gt;</span> 0<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #006600; font-style: italic;">// We didn't want the picker to remain open if the user backspaces to empty</span>
                        cmp.<span style="color: #660066;">collapse</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'beforeselect'</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>cmp<span style="color: #339933;">,</span> record<span style="color: #339933;">,</span> index<span style="color: #339933;">,</span> opts<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #003366; font-weight: bold;">var</span> terms <span style="color: #339933;">=</span> cmp.<span style="color: #660066;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span> <span style="color: #009966; font-style: italic;">/,\s*/</span> <span style="color: #009900;">&#41;</span>;
                    terms.<span style="color: #660066;">pop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
                    terms.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span>record.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'email'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
                    terms.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>;
                    cmp.<span style="color: #660066;">setValue</span><span style="color: #009900;">&#40;</span>terms.<span style="color: #660066;">join</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;, &quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
                    cmp.<span style="color: #660066;">collapse</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
                    <span style="color: #006600; font-style: italic;">// We've handled the updating of the field, return false to cancel the default behavior</span>
                    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span>;
                <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'beforequery'</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>queryEvent<span style="color: #339933;">,</span> opts<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #003366; font-weight: bold;">var</span> terms <span style="color: #339933;">=</span> queryEvent.<span style="color: #660066;">query</span>.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span> <span style="color: #009966; font-style: italic;">/,\s*/</span> <span style="color: #009900;">&#41;</span>;
                    queryEvent.<span style="color: #660066;">query</span> <span style="color: #339933;">=</span> terms<span style="color: #009900;">&#91;</span>terms.<span style="color: #660066;">length</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>;
                    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span>queryEvent.<span style="color: #660066;">query</span> <span style="color: #339933;">&amp;&amp;</span> queryEvent.<span style="color: #660066;">query</span>.<span style="color: #660066;">length</span> <span style="color: #339933;">&gt;</span> 0<span style="color: #009900;">&#41;</span>;
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://bildtsen.com/2012/05/extjs-4-combobox-with-multiple-auto-complete-values/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ExtJS 4.0.7: Getting default GridPanel multiSelect behavior when using &#8216;gridviewdragdrop&#8217; plugin</title>
		<link>http://bildtsen.com/2012/02/extjs-4-0-7-getting-default-gridpanel-multiselect-behavior-when-using-gridviewdragdrop-plugin/</link>
		<comments>http://bildtsen.com/2012/02/extjs-4-0-7-getting-default-gridpanel-multiselect-behavior-when-using-gridviewdragdrop-plugin/#comments</comments>
		<pubDate>Fri, 24 Feb 2012 19:19:07 +0000</pubDate>
		<dc:creator>Ola Bildtsen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://bildtsen.com/?p=209</guid>
		<description><![CDATA[With ExtJS 4 comes the nice feature of being able to set up dragging from a GridPanel by simply specifying the &#8216;gridviewdragdrop&#8217; plugin on the viewConfig, like so: ... multiSelect: true, viewConfig: &#123; copy: true, plugins: &#123; ptype: 'gridviewdragdrop', dragGroup: 'myDDGroup', enableDrop: false &#125; &#125;, ... But when the &#8216;gridviewdragdrop&#8217; plugin is added, one default [...]]]></description>
			<content:encoded><![CDATA[<p>With ExtJS 4 comes the nice feature of being able to set up dragging from a GridPanel by simply specifying the &#8216;gridviewdragdrop&#8217; plugin on the viewConfig, like so:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;">...
<span style="color: #660066;">multiSelect</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
viewConfig<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
    copy<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
    plugins<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
        ptype<span style="color: #339933;">:</span> <span style="color: #3366CC;">'gridviewdragdrop'</span><span style="color: #339933;">,</span>
        dragGroup<span style="color: #339933;">:</span> <span style="color: #3366CC;">'myDDGroup'</span><span style="color: #339933;">,</span>
        enableDrop<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
...</pre></div></div>

<p>But when the &#8216;gridviewdragdrop&#8217; plugin is added, one default feature of the normal GridPanel selection model goes away: if multiple items are selected in the grid and one of those selected items is clicked, all the others should be deselected and that one items should remain selected.  With the plugin added, a click on one of the selected items does nothing &#8212; all items remain selected.  This behavior is due to the following snippet from Ext.view.DragZone:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;">    onItemMouseDown<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>view<span style="color: #339933;">,</span> record<span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">item</span><span style="color: #339933;">,</span> index<span style="color: #339933;">,</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">isPreventDrag</span><span style="color: #009900;">&#40;</span>e<span style="color: #339933;">,</span> record<span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">item</span><span style="color: #339933;">,</span> index<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">handleMouseDown</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span>;
&nbsp;
            <span style="color: #006600; font-style: italic;">// If we want to allow dragging of multi-selections, then veto the following handlers (which, in the absence of ctrlKey, would deselect)</span>
            <span style="color: #006600; font-style: italic;">// if the mousedowned record is selected</span>
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>view.<span style="color: #660066;">getSelectionModel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">selectionMode</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'MULTI'</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span>e.<span style="color: #660066;">ctrlKey</span> <span style="color: #339933;">&amp;&amp;</span> view.<span style="color: #660066;">getSelectionModel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">isSelected</span><span style="color: #009900;">&#40;</span>record<span style="color: #009900;">&#41;</span><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;">false</span>;
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span></pre></div></div>

<p>As the comment states, the event is cancelled in order to prevent the deselect of the multiple selected items before the drag happens.  One way to get around this and reinstate the default select behavior is to override Ext.view.DragZone like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;">Ext.<span style="color: #660066;">view</span>.<span style="color: #660066;">DragZone</span>.<span style="color: #660066;">override</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
&nbsp;
    singleSelectRecord<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span>
&nbsp;
    onItemMouseDown<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>view<span style="color: #339933;">,</span> record<span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">item</span><span style="color: #339933;">,</span> index<span style="color: #339933;">,</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">isPreventDrag</span><span style="color: #009900;">&#40;</span>e<span style="color: #339933;">,</span> record<span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">item</span><span style="color: #339933;">,</span> index<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">handleMouseDown</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span>;
&nbsp;
            <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">singleSelectRecord</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">null</span>;
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>view.<span style="color: #660066;">getSelectionModel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">selectionMode</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'MULTI'</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span>e.<span style="color: #660066;">ctrlKey</span> <span style="color: #339933;">&amp;&amp;</span> view.<span style="color: #660066;">getSelectionModel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">isSelected</span><span style="color: #009900;">&#40;</span>record<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>view.<span style="color: #660066;">getSelectionModel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getCount</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #006600; font-style: italic;">// Default behavior of the dragzone is to simply return false.  But that cancels the default grid</span>
                    <span style="color: #006600; font-style: italic;">// behavior of selecting the one thing if multiple things were selected.  So instead, save the</span>
                    <span style="color: #006600; font-style: italic;">// record here and do the default grid behavior if a drag is never initiated.</span>
                    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">singleSelectRecord</span> <span style="color: #339933;">=</span> record;
                <span style="color: #009900;">&#125;</span>
                <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span>;
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
    onStartDrag<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>x<span style="color: #339933;">,</span> y<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #006600; font-style: italic;">// Drag was initiated, so don't do default grid behavior (see above)</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">singleSelectRecord</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">null</span>;
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
    onMouseUp<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">singleSelectRecord</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #006600; font-style: italic;">// Drag was not initiated, and we have a record (see above), so now do the default grid behavior</span>
            <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">view</span>.<span style="color: #660066;">getSelectionModel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">select</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">singleSelectRecord</span><span style="color: #009900;">&#41;</span>;
            <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">singleSelectRecord</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">null</span>;
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p>The comments in the code should speak for themselves, but in essence we&#8217;re retaining the record for which we cancelled the default select behavior and then acting on it if the drag was never initiated before the next mouseup event.</p>
]]></content:encoded>
			<wfw:commentRss>http://bildtsen.com/2012/02/extjs-4-0-7-getting-default-gridpanel-multiselect-behavior-when-using-gridviewdragdrop-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updated DropZone example for Ext JS 4.0</title>
		<link>http://bildtsen.com/2012/02/updated-dropzone-example-for-ext-js-4-0/</link>
		<comments>http://bildtsen.com/2012/02/updated-dropzone-example-for-ext-js-4-0/#comments</comments>
		<pubDate>Tue, 14 Feb 2012 20:37:10 +0000</pubDate>
		<dc:creator>Ola Bildtsen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://bildtsen.com/?p=203</guid>
		<description><![CDATA[Since the example of a custom DropZone for a GridPanel in the 4.0.7 API docs is out of date (and doesn&#8217;t work), and I wasn&#8217;t able to find a working example, here&#8217;s a simplified example of a custom DropZone for a GridPanel. This listener is attached to the GridPanel component, and notice that we need [...]]]></description>
			<content:encoded><![CDATA[<p>Since the example of a custom DropZone for a GridPanel in the 4.0.7 API docs is out of date (and doesn&#8217;t work), and I wasn&#8217;t able to find a working example, here&#8217;s a simplified example of a custom DropZone for a GridPanel.  This listener is attached to the GridPanel component, and notice that we need to do it in afterrender, not render:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;">...
                <span style="color: #3366CC;">'afterrender'</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>cmp<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">dropZone</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Ext.<span style="color: #660066;">dd</span>.<span style="color: #660066;">DropZone</span><span style="color: #009900;">&#40;</span>cmp.<span style="color: #660066;">getView</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getEl</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
&nbsp;
                        getTargetFromEvent<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                            <span style="color: #000066; font-weight: bold;">return</span> e.<span style="color: #660066;">getTarget</span><span style="color: #009900;">&#40;</span>cmp.<span style="color: #660066;">getView</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">itemSelector</span><span style="color: #009900;">&#41;</span>;
                        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
                        onNodeOver <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>target<span style="color: #339933;">,</span> dd<span style="color: #339933;">,</span> e<span style="color: #339933;">,</span> data<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                            <span style="color: #000066; font-weight: bold;">return</span> Ext.<span style="color: #660066;">dd</span>.<span style="color: #660066;">DropZone</span>.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">dropAllowed</span>;
                        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
                        onNodeDrop <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>target<span style="color: #339933;">,</span> dd<span style="color: #339933;">,</span> e<span style="color: #339933;">,</span> data<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                            <span style="color: #003366; font-weight: bold;">var</span> record <span style="color: #339933;">=</span> cmp.<span style="color: #660066;">getView</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getRecord</span><span style="color: #009900;">&#40;</span>target<span style="color: #009900;">&#41;</span>;
                            <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span>;
                        <span style="color: #009900;">&#125;</span>
                    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
                <span style="color: #009900;">&#125;</span>
...</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://bildtsen.com/2012/02/updated-dropzone-example-for-ext-js-4-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Preventing SWF reload in Ext JS 4 card layout</title>
		<link>http://bildtsen.com/2012/02/preventing-swf-reload-in-ext-js-4-card-layout/</link>
		<comments>http://bildtsen.com/2012/02/preventing-swf-reload-in-ext-js-4-card-layout/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 14:07:23 +0000</pubDate>
		<dc:creator>Ola Bildtsen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://bildtsen.com/?p=190</guid>
		<description><![CDATA[We have a SWF object in an Ext JS 4 card layout, and were getting annoyed that each time you switched away from that card the SWF would reload.  Our layout is actually a nested card layout (two levels deep), so the problem was a little more complicated.  I tried various ways around this with [...]]]></description>
			<content:encoded><![CDATA[<p>We have a SWF object in an Ext JS 4 card layout, and were getting annoyed that each time you switched away from that card the SWF would reload.  Our layout is actually a nested card layout (two levels deep), so the problem was a little more complicated.  I tried various ways around this with mixed success, the biggest issue being that it worked differently in Firefox and Chrome.  After much searching I finally came across this post: <a href="http://www.sencha.com/forum/archive/index.php/t-22016.html">http://www.sencha.com/forum/archive/index.php/t-22016.html</a>.  By applying the following to each card-layout panel (setting the defaults for its children/items), the SWF won&#8217;t reload in Chrome, Firefox, IE 8+, or Safari when hiding/showing the card:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;">...
                <span style="color: #009900;">&#123;</span>
                    xtype<span style="color: #339933;">:</span> <span style="color: #3366CC;">'panel'</span><span style="color: #339933;">,</span>
                    layout<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
                        type<span style="color: #339933;">:</span> <span style="color: #3366CC;">'card'</span>
                    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
                    defaults<span style="color: #339933;">:</span> Ext.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
                        closable<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>
                    Ext.<span style="color: #660066;">isGecko</span> <span style="color: #339933;">?</span>
                        <span style="color: #009900;">&#123;</span>
                            style<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
                                position<span style="color: #339933;">:</span><span style="color: #3366CC;">'absolute'</span>
                            <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
                            hideMode<span style="color: #339933;">:</span> <span style="color: #3366CC;">'visibility'</span>
                        <span style="color: #009900;">&#125;</span>
                        <span style="color: #339933;">:</span>
                        <span style="color: #009900;">&#123;</span>
                            hideMode<span style="color: #339933;">:</span> <span style="color: #3366CC;">'offsets'</span>
                        <span style="color: #009900;">&#125;</span>
                    <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                    items<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
...</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://bildtsen.com/2012/02/preventing-swf-reload-in-ext-js-4-card-layout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stark Security version 0.4.3 released</title>
		<link>http://bildtsen.com/2009/11/stark-security-version-0-4-3-released/</link>
		<comments>http://bildtsen.com/2009/11/stark-security-version-0-4-3-released/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 19:39:59 +0000</pubDate>
		<dc:creator>Ola Bildtsen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://bildtsen.com/?p=179</guid>
		<description><![CDATA[I&#8217;m pleased to announce the latest version of the Stark Security plugin for Grails has been released. Docs have been updated and release notes are available: http://grails.org/plugin/stark-security. In short, this release upgrades to Spring Security 2.0.5, and contains a fix for configurable support for session fixation attack prevention.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m pleased to announce the latest version of the Stark Security plugin for Grails has been released.  Docs have been updated and release notes are available: <a href="http://grails.org/plugin/stark-security">http://grails.org/plugin/stark-security</a>.</p>
<p>In short, this release upgrades to Spring Security 2.0.5, and contains a fix for configurable support for session fixation attack prevention.</p>
]]></content:encoded>
			<wfw:commentRss>http://bildtsen.com/2009/11/stark-security-version-0-4-3-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Webcast: Introduction to Flex and AIR</title>
		<link>http://bildtsen.com/2009/10/webcast-introduction-to-flex-and-air/</link>
		<comments>http://bildtsen.com/2009/10/webcast-introduction-to-flex-and-air/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 17:29:08 +0000</pubDate>
		<dc:creator>Ola Bildtsen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://bildtsen.com/?p=158</guid>
		<description><![CDATA[I recently did a &#8220;tech talk&#8221; at work &#8212; an introduction to Adobe&#8217;s Flex and AIR. The presentation is geared to the techie with some UI-building experience but with little or no knowledge of Flex or FlexBuilder. Although there are some high-level introductory/overview slides up front, the bulk of the presentation is a build-it-from-scratch session [...]]]></description>
			<content:encoded><![CDATA[<p>I recently did a &#8220;tech talk&#8221; at work &#8212; <a href="http://bildtsen.com/wp-content/uploads/2009/10/FlexIntroPresentationLarge.mov">an introduction to Adobe&#8217;s Flex and AIR</a>.  The presentation is geared to the techie with some UI-building experience but with little or no knowledge of Flex or FlexBuilder.</p>
<p>Although there are some high-level introductory/overview slides up front, the bulk of the presentation is a build-it-from-scratch session that shows how to use FlexBuilder to put together a simple Flex app (the obligatory Twitter client).  It also shows how to work with a library project, and then goes on to create an AIR application using a shared component.  Towards the end, I&#8217;m firing up FlexMonkey to show how to test the Flex app we built and how to generate the scripts and AS3 code needed to integrate those tests in a CI build.</p>
<p>The slides are <a href='http://bildtsen.com/wp-content/uploads/2009/10/FlexIntroSlides.pdf'>here</a>.  There are not that many, but there are some useful links on the last slide.</p>
<p>The Flex projects built during the presentation are <a href='http://bildtsen.com/wp-content/uploads/2009/10/FlexAirDemo.tar.gz'>here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bildtsen.com/2009/10/webcast-introduction-to-flex-and-air/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://bildtsen.com/wp-content/uploads/2009/10/FlexIntroPresentationLarge.mov" length="281253296" type="video/quicktime" />
		</item>
		<item>
		<title>Stark Security version 0.4.2 released</title>
		<link>http://bildtsen.com/2009/01/stark-security-version-042-released/</link>
		<comments>http://bildtsen.com/2009/01/stark-security-version-042-released/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 17:08:11 +0000</pubDate>
		<dc:creator>Ola Bildtsen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://bildtsen.com/?p=155</guid>
		<description><![CDATA[Readers of this blog and people on the grails user list noted some difficulties with UTF encoding with the previous release of the stark security plugin.  I&#8217;m happy to announce this bug-fix release (version 0.4.2) which takes care of the UTF encoding problem, and also fixes another defect related to moving the User and Role [...]]]></description>
			<content:encoded><![CDATA[<p>Readers of this blog and people on the grails user list noted some difficulties with UTF encoding with the previous release of the stark security plugin.  I&#8217;m happy to announce this bug-fix release (version 0.4.2) which takes care of the UTF encoding problem, and also fixes another defect related to moving the User and Role domain classes into packages.</p>
<p>Please give it a whirl and let me know if you have any comments and/or questions!</p>
<p>Docs and release notes are here: http://www.grails.org/Stark+Security+Plugin</p>
]]></content:encoded>
			<wfw:commentRss>http://bildtsen.com/2009/01/stark-security-version-042-released/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Stark Security Version 0.4 Released</title>
		<link>http://bildtsen.com/2009/01/stark-security-version-04-released/</link>
		<comments>http://bildtsen.com/2009/01/stark-security-version-04-released/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 17:33:52 +0000</pubDate>
		<dc:creator>Ola Bildtsen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://bildtsen.com/?p=151</guid>
		<description><![CDATA[This is the second release since my last post &#8212; since 0.2.x these are the highlight changes: allow for simple listening/handling of Spring Security authentication/authorization events allow the application to participate/intercept at various points of the Spring Security filter chain. various defect fixes Updated docs and release details are available here: http://www.grails.org/Stark+Security+Plugin]]></description>
			<content:encoded><![CDATA[<p>This is the second release since my last post &#8212; since 0.2.x these are the highlight changes:</p>
<ul>
<li>allow for simple listening/handling of Spring Security authentication/authorization events</li>
<li>allow the application to participate/intercept at various points of the Spring Security filter chain.</li>
<li>various defect fixes</li>
</ul>
<p>Updated docs and release details are available here: <a href="http://www.grails.org/Stark+Security+Plugin" target="_blank">http://www.grails.org/Stark+Security+Plugin</a></p>
]]></content:encoded>
			<wfw:commentRss>http://bildtsen.com/2009/01/stark-security-version-04-released/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Stark Security Plugin version 0.2.2 Released</title>
		<link>http://bildtsen.com/2008/12/stark-security-plugin-version-02-released/</link>
		<comments>http://bildtsen.com/2008/12/stark-security-plugin-version-02-released/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 16:49:54 +0000</pubDate>
		<dc:creator>Ola Bildtsen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://bildtsen.com/?p=146</guid>
		<description><![CDATA[I&#8217;m pleased to announce the release of version 0.2 of the Stark Security plugin. Not a huge deal, but a few convenience enhancements: Enable arbitrary password encoding algorithms, on a DAO provider basis Allow for tweaks to authorization mappings in StarkSecurityConfig.groovy without app restart. Let user install the plugin but defer configuration (this used to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m pleased to announce the release of version 0.2 of the Stark Security plugin.  Not a huge deal, but a few convenience enhancements:</p>
<ul>
<li>Enable arbitrary password encoding algorithms, on a DAO provider basis</li>
<li>Allow for tweaks to authorization mappings in StarkSecurityConfig.groovy without app restart.</li>
<li>Let user install the plugin but defer configuration (this used to result in exceptions on app startup).</li>
</ul>
<p>The 0.2.2 bug-fix release solves an issue with custom url mappings not responding to the authorization mappings in controllers.  With this fix, any custom mappings in UrlMappings will resolve to the authorization mappings of the eventual controller target.</p>
<p>Documentation (including upgrade instructions, release notes, etc.) is here: <a href="http://www.grails.org/Stark+Security+Plugin">http://www.grails.org/Stark+Security+Plugin</a></p>
<p>As always, comments/questions/suggestions are much appreciated!</p>
]]></content:encoded>
			<wfw:commentRss>http://bildtsen.com/2008/12/stark-security-plugin-version-02-released/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Announcing Stark Security Plugin for Grails</title>
		<link>http://bildtsen.com/2008/11/announcing-stark-security-plugin-for-grails/</link>
		<comments>http://bildtsen.com/2008/11/announcing-stark-security-plugin-for-grails/#comments</comments>
		<pubDate>Sat, 22 Nov 2008 22:33:21 +0000</pubDate>
		<dc:creator>Ola Bildtsen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://bildtsen.com/?p=142</guid>
		<description><![CDATA[I&#8217;m happy to announce the release of the new Stark Security plugin to the Grails plugins repository. It&#8217;s a cleaned-up (and, hopefully, simplified) edition of the alternative Spring Security plugin previously mentioned here. The main focus of this plugin is to provide a simple yet strong security solution, and it&#8217;s different from the standard acegi [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m happy to announce the release of the new Stark Security plugin to the Grails plugins repository.  It&#8217;s a cleaned-up (and, hopefully, simplified) edition of the alternative Spring Security plugin <a href="http://bildtsen.com/?p=122">previously mentioned here</a>.  The main focus of this plugin is to provide a simple yet strong security solution, and it&#8217;s different from the standard acegi and jsecurity plugins in that it offers:</p>
<ul>
<li><b>Lock-down or &#8216;pessimistic&#8217; approach.</b> Instead of leaving the web application open and relying on configured rules to lock down certain areas, the Stark Security plugin locks down everything by default. Developers open up access on a controller-method basis as they are coding the controllers.</li>
<li><b>Authorization mappings by convention.</b> The determination of which roles can access which URLs is declared by convention in every controller, right next to the eventual URL end-points (controller methods). This makes for very straight-forward implementation and maintenance of the security rules.</li>
</ul>
<p>Version 0.1 is available by simply running this from within your Grails project:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">grails install-plugin stark-security</pre></div></div>

<p>Documentation is available at the <a href="http://www.grails.org/Stark+Security+Plugin">Stark Security Plugin page</a> at the <a href="http://grails.org/Plugins#">Grails plugins web site</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bildtsen.com/2008/11/announcing-stark-security-plugin-for-grails/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

