Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / examples / direct / direct-grid.js
diff --git a/examples/direct/direct-grid.js b/examples/direct/direct-grid.js
new file mode 100644 (file)
index 0000000..90703fc
--- /dev/null
@@ -0,0 +1,48 @@
+Ext.require([
+    'Ext.direct.*',
+    'Ext.data.*',
+    'Ext.grid.*',
+    'Ext.util.Format'
+]);
+
+Ext.define('Company', {
+    extend: 'Ext.data.Model',
+    fields: ['name', 'turnover']
+});
+
+Ext.onReady(function() {    
+    Ext.direct.Manager.addProvider(Ext.app.REMOTING_API);
+    
+    
+    // create the Tree
+    Ext.create('Ext.grid.Panel', {
+        store: {
+            model: 'Company',
+            remoteSort: true,
+            autoLoad: true,
+            sorters: [{
+                property: 'name',
+                direction: 'ASC'
+            }],
+            proxy: {
+                type: 'direct',
+                directFn: TestAction.getGrid
+            }
+        },
+        columns: [{
+            dataIndex: 'name',
+            flex: 1,
+            text: 'Name'
+        }, {
+            dataIndex: 'turnover',
+            align: 'right',
+            width: 120,
+            text: 'Turnover pa.',
+            renderer: Ext.util.Format.usMoney
+        }],
+        height: 350,
+        width: 600,
+        title: 'Company Grid',
+        renderTo: Ext.getBody()
+    });
+});
\ No newline at end of file