Upgrade to ExtJS 4.0.7 - Released 10/19/2011
[extjs.git] / examples / key-feed-viewer / viewer / FeedPanel.js
index 6076782..95e1a02 100644 (file)
@@ -1,3 +1,17 @@
+/*
+
+This file is part of Ext JS 4
+
+Copyright (c) 2011 Sencha Inc
+
+Contact:  http://www.sencha.com/contact
+
+GNU General Public License Usage
+This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file.  Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
+
+If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
+
+*/
 /**
  * @class FeedViewer.FeedPanel
  * @extends Ext.panel.Panel
@@ -14,11 +28,12 @@ Ext.define('FeedViewer.FeedPanel', {
 
     alias: 'widget.feedpanel',
 
+    animCollapse: true,
+    layout: 'fit',
+    title: 'Feeds',
+
     initComponent: function(){
         Ext.apply(this, {
-            layout: 'fit',
-            title: 'Feeds',
-            animCollapse: true,
             items: this.createView(),
             dockedItems: [this.createToolbar()]
         });
@@ -44,13 +59,6 @@ Ext.define('FeedViewer.FeedPanel', {
         this.callParent(arguments);
     },
 
-    // template method
-    afterRender: function(){
-        this.callParent(arguments);
-        var view = this.view;
-        view.getSelectionModel().select(view.store.first());
-    },
-
     /**
      * Create the DataView to be used for the feed list.
      * @private
@@ -71,7 +79,8 @@ Ext.define('FeedViewer.FeedPanel', {
             },
             listeners: {
                 scope: this,
-                contextmenu: this.onContextMenu
+                contextmenu: this.onContextMenu,
+                viewready: this.onViewReady
             },
             trackOver: true,
             cls: 'feed-list',
@@ -86,6 +95,10 @@ Ext.define('FeedViewer.FeedPanel', {
         return this.view;
     },
 
+    onViewReady: function(){
+        this.view.getSelectionModel().select(this.view.store.first());
+    },
+
     /**
      * Creates the toolbar to be used for controlling feeds.
      * @private
@@ -272,3 +285,4 @@ Ext.define('FeedViewer.FeedPanel', {
         this.callParent(arguments);
     }
 });
+