commit extjs-2.2.1
[extjs.git] / examples / remoteload / EmployeeGrid.js
1 /*\r
2  * Ext JS Library 2.2.1\r
3  * Copyright(c) 2006-2009, Ext JS, LLC.\r
4  * licensing@extjs.com\r
5  * \r
6  * http://extjs.com/license\r
7  */\r
8 \r
9 Ext.ns('App');\r
10 \r
11 App.EmployeeGrid = Ext.extend(Ext.grid.GridPanel, {\r
12         initComponent: function() {\r
13                 this.columns = [\r
14                         {dataIndex: 'lastName', header: 'Name', renderer: this.renderName},\r
15                         {dataIndex: 'department', header: 'Department'},\r
16                         {dataIndex: 'title', header: 'Title'},\r
17                         {dataIndex: 'telephone', header: 'Telephone'},\r
18                         {dataIndex: 'office', header: 'Office'}\r
19                 ];\r
20                 this.viewConfig = {\r
21                         forceFit: true\r
22                 };\r
23                 App.EmployeeGrid.superclass.initComponent.call(this);\r
24                 this.getSelectionModel().on('rowselect', this.onRowSelect, this, {buffer: 300});\r
25                 this.store.load();\r
26         },\r
27         renderName: function(val, md, record) {\r
28                 return String.format('{0}, {1}', val, record.get('firstName'));\r
29         },\r
30         onRowSelect: function(sm, idx, r) {\r
31                 Ext.getCmp('employeeDetails').load(r.id);\r
32         }\r
33 });\r
34 Ext.reg('employeegrid', App.EmployeeGrid);\r