<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
    <channel>
        <title>One damn thing after another</title>
        <link>http://hutten.org/bill/extjs/</link>
        <description>Trying to understand stuff that never sits still.</description>
        <language>en</language>
        <copyright>Copyright 2010</copyright>
        <lastBuildDate>Thu, 20 May 2010 15:45:31 -0400</lastBuildDate>
        <generator>http://www.sixapart.com/movabletype/</generator>
        <docs>http://www.rssboard.org/rss-specification</docs>
        
        <item>
            <title>RESTful store example as a pre-configured class</title>
            <description><![CDATA[<p>The ExtJS 3.2+ examples include a &#8220;RESTful store&#8221; which is a very interesting no-code way to get full CRUD behaviour from a GridPanel. Unfortunately the example is not written with a reusable structure - here is the same example, but as a pre-configured class: <br /><br /></p>

<pre><code>
Ext.onReady(function() {
            Ext.QuickTips.init();

            var TheGrid = Ext.extend(Ext.grid.GridPanel, {
                        title: 'Users',
                        frame: true,
                        height: 300,
                        width: 500,
                        viewConfig: {
                            forceFit: true
                        },
                        editor: new Ext.ux.grid.RowEditor({
                                    saveText: 'Update'
                                }),


                        onAdd: function(btn, ev) {
                            var u = new this.store.recordType({
                                        first: '',
                                        last: '',
                                        email: ''
                                    });
                            this.editor.stopEditing();
                            this.store.insert(0, u);
                            this.editor.startEditing(0);
                        },


                        onDelete: function() {
                            var rec = this.getSelectionModel().getSelected();
                            if (rec) {
                                this.store.remove(rec);
                            }
                        },


                        initComponent: function() {
                            var proxy = new Ext.data.HttpProxy({
                                        url: 'app.php/users'
                                    });

                            var reader = new Ext.data.JsonReader({
                                        totalProperty: 'total',
                                        successProperty: 'success',
                                        idProperty: 'id',
                                        root: 'data',
                                        messageProperty: 'message' // attribute in server response for user message...
                                    }, [{
                                                name: 'id'
                                            }, {
                                                name: 'email'
                                            }, {
                                                name: 'first',
                                                allowBlank: false
                                            }, {
                                                name: 'last'
                                            }]);

                            var writer = new Ext.data.JsonWriter({
                                        encode: false
                                    });

                            var store = new Ext.data.Store({
                                        restful: true,
                                        proxy: proxy,
                                        reader: reader,
                                        writer: writer
                                    });

                            var config = {
                                store: store,
                                plugins: [this.editor],
                                columns: [{
                                            header: "ID",
                                            width: 40,
                                            sortable: true,
                                            dataIndex: 'id'
                                        }, {
                                            header: "Email",
                                            width: 100,
                                            sortable: true,
                                            dataIndex: 'email',
                                            editor: new Ext.form.TextField({})
                                        }, {
                                            header: "First",
                                            width: 50,
                                            sortable: true,
                                            dataIndex: 'first',
                                            editor: new Ext.form.TextField({})
                                        }, {
                                            header: "Last",
                                            width: 50,
                                            sortable: true,
                                            dataIndex: 'last',
                                            editor: new Ext.form.TextField({})
                                        }],
                                tbar: [{
                                            text: 'Add',
                                            iconCls: 'silk-add',
                                            handler: this.onAdd,
                                            scope: this
                                        }, '-', {
                                            text: 'Delete',
                                            iconCls: 'silk-delete',
                                            handler: this.onDelete,
                                            scope: this
                                        }, '-']
                            };

                            Ext.apply(this, Ext.apply(this.initialConfig, config));
                            TheGrid.superclass.initComponent.apply(this, arguments);

                        },


                        onRender: function() {
                            this.store.load();
                            TheGrid.superclass.onRender.apply(this, arguments);
                        }
                    });
            Ext.reg('my_grid', TheGrid);



            var w = new Ext.Window({
                        modal: true,
                        items: {
                            xtype: 'my_grid',
                            title: 'Panel 1'
                        }
                    });
            w.show();
        });
</code>﻿</pre>
]]></description>
            <link>http://hutten.org/bill/extjs/2010/05/restful-store-example-as-a-pre.html</link>
            <guid>http://hutten.org/bill/extjs/2010/05/restful-store-example-as-a-pre.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">ExtJS</category>
            
            
            <pubDate>Thu, 20 May 2010 15:45:31 -0400</pubDate>
        </item>
        
        <item>
            <title>Using the &apos;ref&apos; option in ExtJS 3.x</title>
            <description><![CDATA[<p>As with so many things in ExtJS, the &#8216;ref&#8217; option introduced in 3.0 is not very well documented, at least as far as I can tell.  Which is unfortunate, because it&#8217;s <em>extremely</em> useful, and drastically reduces the need for ids.  Here&#8217;s an example of how to use it:<br /><br /></p>

<pre><code>Ext.onReady(function() {
            Ext.BLANK_IMAGE_URL = 'ext/resources/images/default/s.gif';
            Ext.QuickTips.init();


            // Define a simple component

            MyComponent = Ext.extend(Ext.form.FormPanel, {
                        frame: true,

                        initComponent: function() {
                            var config = {
                                items: [{
                                            xtype: 'textfield',
                                            fieldLabel: 'Name'
                                        }, {
                                            xtype: 'textfield',
                                            fieldLabel: 'Address'
                                        }],
                                bbar: ['-&gt;', {
                                            text: 'Cancel',
                                            minWidth: 100,
                                            ref: '../cancelButton' 
                                        }, {
                                            text: 'Save',
                                            minWidth: 100,
                                            ref: '../saveButton' 
                                        }]
                            };

                            Ext.apply(this, Ext.apply(this.initialConfig, config));
                            MyComponent.superclass.initComponent.apply(this, arguments);

                        }
                    });
            Ext.reg('my_component_xtype', MyComponent);


            // Create a display a window with the panel in it...

            var w = new Ext.Window({
                        modal: true,
                        items: {
                            xtype: 'my_component_xtype',
                            title: 'Panel 1',
                            ref: 'theFormPanel'
                        }
                    });
            w.show();


            // See how we can use the references...

            w.theFormPanel.saveButton.on('click', function() {
                        console.log('Save was clicked');
                    }, this);

            console.log(w.theFormPanel.title);
        });
</code></pre>
]]></description>
            <link>http://hutten.org/bill/extjs/2010/05/using-the-ref-option-in-extjs.html</link>
            <guid>http://hutten.org/bill/extjs/2010/05/using-the-ref-option-in-extjs.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">ExtJS</category>
            
            
            <pubDate>Mon, 03 May 2010 13:24:36 -0400</pubDate>
        </item>
        
        <item>
            <title>Drupal - adding metadata to FileField</title>
            <description><![CDATA[<p>While working with file uploads in Drupal, I had a situation where I needed to be able to attach metadata to FileFields. Specifically, the site needed to support video uploads, with a low-res Flash video that would be uploaded via Drupal. For each of these Flash videos, there would be a corresponding high-res broadcast video that would be hosted on an external server, and that would be made available to the user via a URL.  So, I needed to be able to attach a &#8220;download URL&#8221; as metadata to each FileField. I wanted my upload form to look like this:</p>

<div style="text-align:center;"><img src="http://hutten.org/bill/extjs//filefield_metadata.jpg" alt="filefield_metadata.jpg" border="0" width="619" height="185" /></div>

<p><br />
A few hours of Google searching led me to think that this was a pretty complex task - <a href="http://www.poplarware.com/cckfieldmodule.html">this page</a> for instance is a detailed description of how to solve the problem, via the creation of a compound CCK field.</p>

<p>However, it turns out that there is a simpler solution, as described <a href="http://www.trellon.com/content/blog/adding-new-fields-to-file-uploads">on the Trellon blog.</a> Below is my description of how I solved the problem using the same technique.</p>

<p>The first thing you need to do is create your own Drupal module - this is very simple, and involves creating a folder in the &#8220;/sites/all/modules/&#8221; folder.  My module is called &#8220;mediacentre&#8221;, so I created &#8220;/sites/all/modules/mediacentre/&#8221;, and in that folder I created two files - &#8220;mediacentre.info&#8221; and &#8220;mediacentre.module&#8221;.<br /><br /></p>

<p>Here is the &#8220;mediacentre.info&#8221; file:</p>

<pre><code>    ; $Id: 
    name = Media Centre
    description = Media Centre
    core = 6.x
</code></pre>

<p><br /><br />
The &#8220;mediacentre.module&#8221; file is a little more complex:</p>

<pre><code>&lt;?php
function mediacentre_form_alter(&amp;$form, $form_state, $form_id) {
    if ($form_id == "story_node_form") {

        // each field can have multiple values, we need to add custom process function to every upload field
        foreach (element_children($form['field_video']) as $key) {
            $type = $form['field_video'][$key]['#type'];

            if ($type == 'filefield_widget') {
                $a = array('filefield_widget_process', 'download_url_widget_process');
                $form['field_video'][$key]['#process'] = $a;

                $va = array('filefield_widget_validate', 'download_url_widget_validate');
                $form['field_video'][$key]['#element_validate'] = $va;
            }
        }
    }
}

function download_url_widget_process($element, $edit, &amp;$form_state, $form) {
    $file = $element['#value'];

    $element['data']['download'] = array(
        '#type' =&gt; 'textfield',
        '#title' =&gt; t('Download URL'),
        '#value' =&gt; $file['fid'] ? $file['data']['download'] : ''
    );

    return $element;
}

function download_url_widget_validate($element, &amp;$form_state) {
}
</code></pre>

<p><br />In the above code the important method is &#8220;mediacentre_form_alter&#8221; - this is a Drupal <em>form hook</em> - the <a href="http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html">Drupal FAPI documentation</a> has much more information on this, most of it horribly confusing if you&#8217;re just trying - like I was - to learn the basics. With the above method in our module, every time Drupal displays a form it will call our form hook, so we can customize the form as needed. </p>

<p>In the form hook method we check for the ID of the form we want to modify - this can be discovered by using Firebug or the Webkit Inspector to examine your page.  In my case, I wanted to modify the Drupal form for editing nodes, and I was looking specifically for the forms that were used to upload my videos.  I was using CCK for these fields, and the field name was &#8220;field_video&#8221;. If you use a different field name, then you have to change the use of &#8216;field_video&#8217; in the method to the name of your own field.</p>

<p>For each &#8216;field_video&#8217;, we check for the &#8216;filefield_widget&#8217;, which is the actual upload form we want to modify, and we replace the existing &#8216;#process&#8217; key for that array with a new value that includes the name of our &#8220;process&#8221; or &#8220;validate&#8221; method. </p>

<p>So, when Drupal displays the &#8220;filefield_widget&#8221;, it will now call our &#8220;download_url_widget_process&#8221; method, and that method will insert a new element into the form with the name &#8216;download&#8217;, and the title &#8216;Download URL&#8217;.</p>

<p>Right now we&#8217;re not doing any particular validation, so we just leave the &#8220;download_url_widget_validate&#8221; method blank. Normally this method would contain code to make sure that the value entered is OK.</p>

<p>And that&#8217;s it!  When displaying your data in a tpl.php you have access to the new &#8220;download&#8221; value, in the same way you would access the &#8220;description&#8221; value, as a key in the item->data array.</p>
]]></description>
            <link>http://hutten.org/bill/extjs/2010/02/drupal-adding-metadata-to-file.html</link>
            <guid>http://hutten.org/bill/extjs/2010/02/drupal-adding-metadata-to-file.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Drupal</category>
            
            
            <pubDate>Mon, 08 Feb 2010 10:28:13 -0400</pubDate>
        </item>
        
        <item>
            <title>How to manually customize Firebug 1.5.0 for widescreen use</title>
            <description><![CDATA[<p><br />There&#8217;s a customized version of Firebug available called <a href="http://www.command-tab.com/2008/01/19/widerbug-widescreen-firebug/">Widerbug</a> that changes the Firebug layout to look like this:</p>

<div style="text-align:center;"><img src="http://hutten.org/bill/extjs//ScreenCapture001.jpg" alt="ScreenCapture001.jpg" border="0" width="617" height="391" /></div>

<p><br /><br />Unfortunately Widerbug is not updated as frequently as Firebug, so if you want to use the most recent versions of Firebug you&#8217;re out of luck.</p>

<p>To solve this issue I used FileMerge to compare Widerbug with a stock release of Firebug, and came up with the following list of required changes:  (<strong>UPDATE:</strong> It turns out that in the Widerbug xpi there&#8217;s a text file &#8220;instructions.txt&#8221; that details these steps as well&#8230;  ha!  Note that the steps described in the Widerbug &#8220;instructions.txt&#8221; are slightly more complex than mine, as they involve changing some Firebug artwork, the update URL, and signing the XPI.)</p>

<p>Anyway, here are my changes for Firebug 1.5.0. We edit the relevant files in-place, after Firebug has been installed. First you need to open the Firefox  &#8220;Profiles&#8221; directory, which on OS X is located at ~/Library/Application Support/Firefox/Profiles - open the appropriate profile, then look for the &#8220;extensions&#8221; directory, and inside that is the &#8220;firebug@software.joehewitt.com&#8221; directory.  Make the following edits:</p>

<p><br />1) <strong><em>content/firebug/browserOverlay.xul</em></strong></p>

<p><em>Replace this:</em></p>

<pre><code>    &lt;vbox id="appcontent"&gt;
        &lt;splitter id="fbContentSplitter" collapsed="true"/&gt;
        &lt;vbox id="fbContentBox" collapsed="true" persist="height"&gt;&lt;/vbox&gt;
    &lt;/vbox&gt;
</code></pre>

<p><em>With this:</em></p>

<pre><code>    &lt;hbox id="browser"&gt;
        &lt;splitter id="fbContentSplitter"/&gt;
        &lt;vbox id="fbContentBox" flex="1" collapsed="true" persist="width"/&gt;
    &lt;/hbox&gt;
</code></pre>

<p><br /><br />2) <strong><em>content/firebug/firebugOverlay.xul</em></strong></p>

<p>Change line 141 from </p>

<pre><code>    &lt;box id="fbPanelPane" flex="1" persist="orient"&gt;
</code></pre>

<p>to</p>

<pre><code>    &lt;vbox id="fbPanelPane" flex="1" persist="orient"&gt;
</code></pre>

<p><br /><br />and change line 276, the corresponding closing tag, from</p>

<pre><code>    &lt;/box&gt;
</code></pre>

<p>to</p>

<pre><code>    &lt;/vbox&gt;
</code></pre>

<p><br /><br />3) <strong><em>content/firebug/firebug.css</em></strong></p>

<p>Insert this:</p>

<pre><code>    #fbToolbox {
        border-top-width: 0px;
        border-top-style: none;
    }
</code></pre>

<p>Before this:</p>

<pre><code>    /************************************************************************************************/
    panelTabMenu {
        -moz-binding: url("chrome://firebug/content/bindings.xml#panelTabMenu");
    }
</code></pre>

<p><br /><br />4) <strong><em>skin/classic/mac/firebug.css</em></strong></p>

<p>Replace this:</p>

<pre><code>    #fbContentSplitter {
        border-top: 1px solid #BBB9BA;
        border-bottom: none;
        background: #f3f3f3 !important;
        min-height: 3px;
        max-height: 3px;
    }
</code></pre>

<p>With this:</p>

<pre><code>    #fbContentSplitter {
        border-left: 1px solid #BBB9BA;
        border-right: 1px solid #BBB9BA;
        background: #f3f3f3 !important;
        min-width: 5px;
        max-width: 5px;
    }
</code></pre>

<p><br /><br />4) <strong><em>skin/classic/win/firebug.css</em></strong></p>

<p>Replace this:</p>

<pre><code>    #fbContentSplitter {
        border-top: 1px solid !important;
        -moz-border-top-colors: threedShadow !important;
        border-bottom: 1px solid !important;
        -moz-border-bottom-colors: #EEEEEE !important;
        min-height: 3px;
        max-height: 3px;
        background-color: #FFFFFF;
    }
</code></pre>

<p>With this:</p>

<pre><code>    #fbContentSplitter {
        border-left: 1px solid !important;
        -moz-border-left-colors: threedShadow !important;
        border-right: 1px solid !important;
        -moz-border-right-colors: threedShadow !important;
        min-width: 3px;
        max-width: 3px;
        background-color: #d4d0c8;
    }
</code></pre>

<p><br /><br /><strong><em>NOTE:</em></strong>  The next time you update Firebug these changes will - of course - be overridden by the new version.  So it&#8217;s pretty ugly, but it works.</p>
]]></description>
            <link>http://hutten.org/bill/extjs/2010/01/how-to-manually-customize-fire.html</link>
            <guid>http://hutten.org/bill/extjs/2010/01/how-to-manually-customize-fire.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Other</category>
            
            
            <pubDate>Mon, 11 Jan 2010 14:32:18 -0400</pubDate>
        </item>
        
        <item>
            <title>Enabling event bubbling for all items in a class</title>
            <description><![CDATA[<p>There doesn't seem to be direct way in ExtJS to indicate that all items in a class should bubble events.  Below is simple workaround - we iterate over all the items in the class in the 'afterRender' event:<br /><br /><br /></p>

<pre><code>Ext.BLANK_IMAGE_URL = 'lib/ext/resources/images/default/s.gif';

Ext.onReady(function() {
        Ext.QuickTips.init();


        FP = Ext.extend(Ext.form.FormPanel, {
                    frame: true,

                    initComponent: function() {
                        var config = {
                            items: [{
                                        xtype: 'textfield',
                                        name: 'First',
                                        fieldLabel: 'First'
                                    }, {
                                        xtype: 'textfield',
                                        name: 'Second',
                                        fieldLabel: 'Second'
                                    }]
                        };

                        Ext.apply(this, Ext.apply(this.initialConfig, config));
                        FP.superclass.initComponent.apply(this, arguments);

                        this.on('change', function(field, newVal, oldVal) {
                                    console.log('form change event on ' + field.name);
                                }, this);
                    },


                    // When the form has been rendered, we step though all the items on 
                    // the form and enable bubbling for each one. In a more complex form
                    // we would need to check the type of each item and enable the right
                    // kind of events, of course.

                    afterRender: function() {
                        FP.superclass.afterRender.apply(this, arguments);
                        Ext.each(this.items.items, function(item) {
                                    item.enableBubble('change');
                                }, this);
                    }
                });


        var fp = new FP();
        var win = new Ext.Window({
                    items: [fp]
                });
        win.show();
    });
</code></pre>
]]></description>
            <link>http://hutten.org/bill/extjs/2009/11/enabling-event-bubbling-for-al.html</link>
            <guid>http://hutten.org/bill/extjs/2009/11/enabling-event-bubbling-for-al.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">ExtJS</category>
            
            
            <pubDate>Tue, 03 Nov 2009 09:14:25 -0400</pubDate>
        </item>
        
        <item>
            <title>Complex objects in classes</title>
            <description><![CDATA[<p><br />
When using Ext.extend to create your own classes, it's critical to understand that complex objects defined outside of a function definition are added to the prototype of the extended class, and as such are <em>shared</em> across all instances of the class. This sharing is <em>not</em> the case with simple attributes.</p>

<p>The solution is to define complex objects inside the "initComponent" function, referencing them via "this".
<br /><br /><hr><br /></p>

<pre><code>Ext.BLANK_IMAGE_URL = 'lib/ext/resources/images/default/s.gif';

Ext.onReady(function() {
        Ext.QuickTips.init();

    // This class definition is broken for most uses - the 'obj' complex object is 
    // created when the class is defined, and as such is shared across all instances
    // of the class! Confusingly, 'simple' class attributes are /not/ shared.

        BrokenClass = Ext.extend(Ext.Panel, {
                    obj: {
                        colour: 'red'
                    },
                    simple: 'one', // this is not shared

                    initComponent: function() {
                        BrokenClass.superclass.initComponent.apply(this, arguments);
                    }
                });


    // This class definition is not broken - the 'obj' complex object is created when an 
    // instance of the class is created, and thus is unique to each instance.

        WorkingClass = Ext.extend(Ext.Panel, {
                    initComponent: function() {
                        this.obj = {
                            colour: 'red'
                        };
                        WorkingClass.superclass.initComponent.apply(this, arguments);
                    }
                });



    // Note that b1 and b2 share the value of 'obj', but do NOT share the value 
    // of 'simple'

        var b1 = new BrokenClass();
        var b2 = new BrokenClass();

        b2.obj.colour = 'blue';
        b2.simple = 'two';

        console.log(b1.obj.colour, b2.obj.colour, b1.simple, b2.simple);


        // Note that w1 and w2 each have their own values for 'obj'

        var w1 = new WorkingClass();
        var w2 = new WorkingClass();

        w1.obj.colour = 'blue';

        console.log(w1.obj.colour, w2.obj.colour);
    });
</code></pre>
]]></description>
            <link>http://hutten.org/bill/extjs/2009/11/complex-objects-in-classes.html</link>
            <guid>http://hutten.org/bill/extjs/2009/11/complex-objects-in-classes.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">ExtJS</category>
            
            
            <pubDate>Mon, 02 Nov 2009 22:10:31 -0400</pubDate>
        </item>
        
        <item>
            <title>GridPanel from JSON data</title>
            <description><![CDATA[<p><br /><br /></p>

<p>Given the following JSON data:<br /><br />
{"totalCount": 2,"items": [{"ID": 1,"Name": "First"},{"ID": 2,"Name": "Second"}]}</p>

<p><br />
Note: ExtJS <em>requires</em> the above format for GridPanel data. The list of data must be wrapped in an object that contains a "total count" attribute, and the list itself is the data of an "items" attribute.  These names of these attributes must match the "totalProperty" and "root" values in the JsonReader of the Store used by the GridPanel. See below.</p>

<p><br /><br /><br />
Here's an ExtJS GridPanel that will load and display it:
<br /><br /></p>

<p>ExampleGrid = Ext.extend(Ext.grid.GridPanel, {
            title: 'Example',
            border: true,
            frame: true,
            closable: true,</p>

<pre><code>        initComponent: function() {

            var proxy = new Ext.data.HttpProxy({
                        url: 'http://host/url/to/get/JSON/data'
                    });

            var store = new Ext.data.Store({
                        remoteSort: true,
                        proxy: proxy,
                        baseParams: {
                            limit: 100
                        },
                        reader: new Ext.data.JsonReader({
                                    totalProperty: 'totalCount',
                                    root: 'items'
                                }, [{
                                            name: 'ID'
                                        }, {
                                            name: 'Name'
                                        }])
                    });

            Ext.apply(this, {
                        loadMask: true,
                        store: store,
                        colModel: new Ext.grid.ColumnModel([{
                                    header: 'ID',
                                    dataIndex: 'ID',
                                    sortable: true
                                }, {
                                    header: 'Name',
                                    dataIndex: 'Name',
                                    sortable: true
                                }])
                    });

            ExampleGrid.superclass.initComponent.apply(this, arguments);
        },

        onRender: function() {
            this.store.load();
            ExampleGrid.superclass.onRender.apply(this, arguments);
        }
    });
</code></pre>

<p>Ext.reg('ExampleGrid_panel', ExampleGrid);</p>
]]></description>
            <link>http://hutten.org/bill/extjs/2009/05/gridpanel-from-json-data.html</link>
            <guid>http://hutten.org/bill/extjs/2009/05/gridpanel-from-json-data.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">ExtJS</category>
            
            
            <pubDate>Tue, 05 May 2009 11:59:04 -0400</pubDate>
        </item>
        
        <item>
            <title>Creating a TreePanel from markup</title>
            <description><![CDATA[<p><br /><br />
Here's an example of how to create an ExtJS  TreePanel from markup. Note the use of "AsyncTreeNode" and "TreeLoader" - even though this is a statically-marked up tree, it will not work without those configuration options. I don't know if this is a lack of understanding on my part or not, but the code below works.  :)
<br /><br /><hr><br /></p>

<pre><code>Ext.BLANK_IMAGE_URL = 'lib/ext/resources/images/default/s.gif';

Ext.onReady(function(){
    Ext.QuickTips.init();


    // Create the "SampleTreePanel" pre-configured class

    SampleTreePanel = Ext.extend(Ext.tree.TreePanel, {
        title: 'Sample Tree Panel',
        width: 200,
        height: 400,
        loader: new Ext.tree.TreeLoader(),
        rootVisible: false,
        border: false,

        initComponent: function(){
            Ext.apply(this, {

                root: new Ext.tree.AsyncTreeNode({
                    children: [{
                        text: 'First',
                        expanded: true,
                        children: [{
                            text: 'one',
                            leaf: true
                        }, {
                            text: 'two',
                            leaf: true
                        }]
                    }, {
                        text: 'Second',
                        expanded: true,
                        children: [{
                            text: 'one',
                            leaf: true
                        }]
                    }]
                })
            })

            SampleTreePanel.superclass.initComponent.apply(this, arguments);
        }
    });
    Ext.reg('tree_panel', SampleTreePanel);


    // Instantiate the tree panel, then attach an event listener..

    var tree = new SampleTreePanel();

    tree.on('click', function(node, e){
        debugger;
    }, this);



    // And create a window to display the tree panel in...

    var wind = new Ext.Window({
        plain: true,
        bodyStyle: 'padding:5px;',
        layout: 'fit',
        items: [tree]
    });

    wind.show();
});
</code></pre>
]]></description>
            <link>http://hutten.org/bill/extjs/2008/07/creating-a-treepanel-from-mark.html</link>
            <guid>http://hutten.org/bill/extjs/2008/07/creating-a-treepanel-from-mark.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">ExtJS</category>
            
            
            <pubDate>Wed, 30 Jul 2008 12:01:42 -0400</pubDate>
        </item>
        
        <item>
            <title>Embedding a FormPanel in another FormPanel</title>
            <description><![CDATA[<p>Often I want to create a pre-configured class to encapsulate some form fields in a reusable way. When doing this, however, you <strong>cannot</strong> extent Ext.FormPanel - if you do this and then try to embed your class in an existing FormPanel you&#8217;ll get an obscure error deep in the bowels of ExtJS.  :(</p>

<p>Instead, extend Ext.Panel, and then create a FormPanel inside your panel.  For example, here&#8217;s a simple &#8220;LocationPanel&#8221; that displays a Campus and Building labels. Note that the class extends Ext.Panel, and then embeds a &#8216;form&#8217; xtype, and the form fields are inside that&#8230;</p>

<pre><code>    LocationPanel = Ext.extend(Ext.Panel, {
        campus: 'defaultCampus',
        building: 'defaultBuilding',

        width: 300,
        height: 50,
        frame: true,
        border: true,
        labelWidth: 75,
        title: 'Location Panel',

        initComponent: function(){
            Ext.apply(this, {
                items: [{
                layout: 'form',
                    items: [{
                        layout: 'column',
                        items: [{
                            columnWidth: '.5',
                            layout: 'form',
                            items: [{
                                    xtype: 'label',
                                    text: this.campus
                            }]
                        }, {
                            columnWidth: '.5',
                            layout: 'form',
                            items: [{
                                    xtype: 'label',
                                    text: this.building
                            }]
                        }]
                    }]
                }]
            });
            LocationPanel.superclass.initComponent.apply(this, arguments);
        }
    });
    Ext.reg('location_panel', LocationPanel);
</code></pre>
]]></description>
            <link>http://hutten.org/bill/extjs/2008/07/embedding-a-formpanel-in-anoth.html</link>
            <guid>http://hutten.org/bill/extjs/2008/07/embedding-a-formpanel-in-anoth.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">ExtJS</category>
            
            
            <pubDate>Sun, 13 Jul 2008 21:43:19 -0400</pubDate>
        </item>
        
        <item>
            <title>Classes with custom events</title>
            <description><![CDATA[<p><br />Here&#8217;s an example of a pre-configured class that fires a custom event, and code that then listens for the event:<br /><br /><br /></p>

<pre><code>Ext.BLANK_IMAGE_URL = 'lib/ext/resources/images/default/s.gif';

Ext.onReady(function(){
    Ext.QuickTips.init();

    MyForm = Ext.extend(Ext.form.FormPanel, {
        id: 'simpleForm',
        title: 'Simple Form',
        frame: true,
        width: 300,
        initComponent: function(){
            Ext.apply(this, {
                renderTo: Ext.getBody(),
                items: [new Ext.Button({
                    id: 'theButton',
                    text: 'Test',
                    listeners: {
                        'click': {

                        // this 'scope' value is CRITICAL so that the event is fired in 
                        // the scope of the component, not the anonymous function...

                            scope: this,        

                            fn: function(field, newVal, oldVal){
                                console.log("custom_event fired");
                                this.fireEvent('custom_event');
                            }
                        }
                    }
                })]
            });
            MyForm.superclass.initComponent.apply(this, arguments);


          // This 'addEvents' call does not seem to be technically required, but most 
          // of the ExtJS examples use it, and it provides a good way of documenting 
          // which events your class fires.

            this.addEvents('custom_event');
        }
    });




    // Create an instance of the form, and listen for the event...

    var simple = new MyForm({});

    simple.on('custom_event', function(){
        console.log("custom event received!");
    });
});
</code></pre>
]]></description>
            <link>http://hutten.org/bill/extjs/2008/07/classes-with-custom-events.html</link>
            <guid>http://hutten.org/bill/extjs/2008/07/classes-with-custom-events.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">ExtJS</category>
            
            
            <pubDate>Sun, 06 Jul 2008 07:19:46 -0400</pubDate>
        </item>
        
        <item>
            <title>ComboBox with remote JSON data</title>
            <description><![CDATA[<p>Assume we have the following JSON data:</p>

<pre><code>stcCallback1001({
    "totalCount":"2",
    "Names":[
        {"name":"one", "ID":"1"},
        {"name":"two", "ID":"2"}
    ]
})
</code></pre>

<p>(Note that the JSON object is wrapped in the &#8220;stcCallback1001&#8221; function - this wrapping is required by the Ext &#8220;ScriptTagProxy&#8221;, which enables cross-site retrieval of data).</p>

<p>Below we have a ComboBox in a panel that will correctly display/handle the above data.  The  <strong>mode: &#8216;remote&#8217;</strong> and <strong>triggerAction: &#8216;all&#8217;</strong> config parameters are critical to getting this to work.<br /><br /><hr><br /></p>

<pre><code>Ext.BLANK_IMAGE_URL = 'lib/ext/resources/images/default/s.gif';

Ext.onReady(function(){
    Ext.QuickTips.init();

    var proxy = new Ext.data.ScriptTagProxy({
        url: 'http://localhost:8080/cbTest'
    });

    var store = new Ext.data.Store({
        proxy: proxy,
        reader: new Ext.data.JsonReader({
            id: 'ID',
            totalProperty: 'totalCount',
            root: 'Names'
        }, [{
            name: 'ID'
        }, {
            name: 'name'
        }])
    });


    var simple = new Ext.form.FormPanel({
        id: 'simpleForm',
        title: 'Simple Form',
        labelWidth: 75,
        frame: true,
        bodyStyle: 'padding:5px 5px 0',
        width: 350,
        renderTo: Ext.getBody(),

        items: [{
            store: store,
            fieldLabel: 'ComboBox',
            displayField: 'name',
            valueField: 'name', 
            typeAhead: true,
            forceSelection: true,
            mode: 'remote',
            triggerAction: 'all',
            selectOnFocus: true,
            editable: true,
            xtype: 'combo',

            listeners: {

                // 'change' will be fired when the value has changed and the user exits the ComboBox via tab, click, etc.
                // The 'newValue' and 'oldValue' params will be from the field specified in the 'valueField' config above.
                change: function(combo, newValue, oldValue){
                    console.log("Old Value: " + oldValue);
                    console.log("New Value: " + newValue);
                },

                // 'select' will be fired as soon as an item in the ComboBox is selected with mouse, keyboard.
                select: function(combo, record, index){
                    console.log(record.data.name);
                    console.log(index);
                }
            }
        }]
    });
});
</code></pre>
]]></description>
            <link>http://hutten.org/bill/extjs/2008/07/combobox-with-remote-json-data.html</link>
            <guid>http://hutten.org/bill/extjs/2008/07/combobox-with-remote-json-data.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">ExtJS</category>
            
            
            <pubDate>Thu, 03 Jul 2008 09:58:46 -0400</pubDate>
        </item>
        
        <item>
            <title>ComboBox with local data in SimpleStore</title>
            <description><![CDATA[<p><br />
An example of a ComboBox in a Panel. The ComboBox is using a local SimpleStore, and responding to the &#8216;select&#8217; and &#8216;change&#8217; events.</p>

<p><hr><br /></p>

<pre><code>Ext.BLANK_IMAGE_URL = 'lib/ext/resources/images/default/s.gif';

Ext.onReady(function(){
    Ext.QuickTips.init();

    var store = new Ext.data.SimpleStore({
        fields: ['dataFieldName', 'displayFieldName'],
        data: [['FLC', 'Carrier'], ['DES', 'Destination'], 
            ['CTY', 'Country'], ['MON', 'Month']],
        autoLoad: false
    });

    var simple = new Ext.form.FormPanel({
        id: 'simpleForm',
        title: 'Simple Form',
        labelWidth: 75,
        frame: true,
        bodyStyle: 'padding:5px 5px 0',
        width: 350,
        renderTo: Ext.getBody(),

        items: [{
            store: store,
            fieldLabel: 'ComboBox',
            displayField: 'displayFieldName',   // what the user sees in the popup
            valueField: 'dataFieldName',        // what is passed to the 'change' event
            typeAhead: true,
            forceSelection: true,
            mode: 'local',
            triggerAction: 'all',
            selectOnFocus: true,
            editable: true,
            xtype: 'combo',

            listeners: {

                // 'change' will be fired when the value has changed and the user exits the 
                // ComboBox via tab, click, etc.  The 'newValue' and 'oldValue' params will 
                // be from the field specified in the 'valueField' config above.
                change: function(combo, newValue, oldValue){
                    console.log("Old Value: " + oldValue);
                    console.log("New Value: " + newValue);
                },

                // 'select' will be fired as soon as an item in the ComboBox is selected.
                select: function(combo, record, index){
                    console.log(record.data.dataFieldName);
                    console.log(record.data.displayFieldName);
                    console.log(index);
                }
            }
        }]
    });
});
</code></pre>
]]></description>
            <link>http://hutten.org/bill/extjs/2008/07/combobox-with-local-data-in-si.html</link>
            <guid>http://hutten.org/bill/extjs/2008/07/combobox-with-local-data-in-si.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">ExtJS</category>
            
            
            <pubDate>Thu, 03 Jul 2008 09:00:44 -0400</pubDate>
        </item>
        
    </channel>
</rss>
