Upgrade to ExtJS 4.0.1 - Released 05/18/2011
[extjs.git] / docs / source / Controller.html
index 045a0d2..7c2da86 100644 (file)
@@ -1,6 +1,22 @@
-<!DOCTYPE html><html><head><title>Sencha Documentation Project</title><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../prettify.css" type="text/css"><link rel="stylesheet" href="../prettify_sa.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script></head><body onload="prettyPrint()"><pre class="prettyprint"><pre><span id='Ext-app.Controller-method-constructor'><span id='Ext-app.Controller'>/**
+<!DOCTYPE html>
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <title>The source code</title>
+  <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
+  <script type="text/javascript" src="../prettify/prettify.js"></script>
+  <style type="text/css">
+    .highlight { display: block; background-color: #ddd; }
+  </style>
+  <script type="text/javascript">
+    function highlight() {
+      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
+    }
+  </script>
+</head>
+<body onload="prettyPrint(); highlight();">
+  <pre class="prettyprint lang-js"><span id='Ext-app-Controller-method-constructor'><span id='Ext-app-Controller'>/**
 </span></span> * @class Ext.app.Controller
- * @constructor
  * 
  * Controllers are the glue that binds an application together. All they really do is listen for events (usually from
  * views) and take some action. Here's how we might create a Controller to manage Users:
  * One of the most useful parts of Controllers is the new ref system. These use the new {@link Ext.ComponentQuery} to
  * make it really easy to get references to Views on your page. Let's look at an example of this now:
  * 
- * Ext.define('MyApp.controller.Users', {
-     extend: 'Ext.app.Controller',
-
-     refs: [
-         {
-             ref: 'list',
-             selector: 'grid'
-         }
-     ],
-
-     init: function() {
-         this.control({
-             'button': {
-                 click: this.refreshGrid
-             }
-         });
-     },
-
-     refreshGrid: function() {
-         this.getList().store.load();
-     }
- });
+ *     Ext.define('MyApp.controller.Users', {
*         extend: 'Ext.app.Controller',
+ *     
*         refs: [
*             {
*                 ref: 'list',
*                 selector: 'grid'
*             }
*         ],
+ *     
*         init: function() {
*             this.control({
*                 'button': {
*                     click: this.refreshGrid
*                 }
*             });
*         },
+ *     
*         refreshGrid: function() {
*             this.getList().store.load();
*         }
*     });
  * 
  * This example assumes the existence of a {@link Ext.grid.Panel Grid} on the page, which contains a single button to 
  * refresh the Grid when clicked. In our refs array, we set up a reference to the grid. There are two parts to this - 
  * Refs aren't the only thing that generate convenient getter methods. Controllers often have to deal with Models and 
  * Stores so the framework offers a couple of easy ways to get access to those too. Let's look at another example:
  * 
- * Ext.define('MyApp.controller.Users', {
-     extend: 'Ext.app.Controller',
-
-     models: ['User'],
-     stores: ['AllUsers', 'AdminUsers'],
-
-     init: function() {
-         var User = this.getUserModel(),
-             allUsers = this.getAllUsersStore();
-
-         var ed = new User({name: 'Ed'});
-         allUsers.add(ed);
-     }
- });
+ *     Ext.define('MyApp.controller.Users', {
*         extend: 'Ext.app.Controller',
+ *     
*         models: ['User'],
*         stores: ['AllUsers', 'AdminUsers'],
+ *     
*         init: function() {
*             var User = this.getUserModel(),
*                 allUsers = this.getAllUsersStore();
+ *     
*             var ed = new User({name: 'Ed'});
*             allUsers.add(ed);
*         }
*     });
  * 
  * By specifying Models and Stores that the Controller cares about, it again dynamically loads them from the appropriate
  * locations (app/model/User.js, app/store/AllUsers.js and app/store/AdminUsers.js in this case) and creates getter 
  * For more information about writing Ext JS 4 applications, please see the &lt;a href=&quot;../guide/application_architecture&quot;&gt;
  * application architecture guide&lt;/a&gt;. Also see the {@link Ext.app.Application} documentation.
  * 
- * @markdown
  * @docauthor Ed Spencer
+ * @constructor
  */  
 Ext.define('Ext.app.Controller', {
-<span id='Ext-app.Controller-cfg-id'>    /**
-</span>     * @cfg {Object} id The id of this controller. You can use this id when dispatching.
+<span id='Ext-app-Controller-cfg-id'>    /**
+</span>     * @cfg {String} id The id of this controller. You can use this id when dispatching.
      */
 
     mixins: {
@@ -283,4 +299,6 @@ Ext.define('Ext.app.Controller', {
         return this.application.getView(view);
     }
 });
-</pre></pre></body></html>
\ No newline at end of file
+</pre>
+</body>
+</html>