2 * Ext JS Library 2.2.1
\r
3 * Copyright(c) 2006-2009, Ext JS, LLC.
\r
4 * licensing@extjs.com
\r
6 * http://extjs.com/license
\r
9 Ext.onReady(function(){
\r
11 Ext.QuickTips.init();
\r
15 var reader = new Ext.data.JsonReader({
\r
16 idProperty:'taskId',
\r
18 {name: 'projectId', type: 'int'},
\r
19 {name: 'project', type: 'string'},
\r
20 {name: 'taskId', type: 'int'},
\r
21 {name: 'description', type: 'string'},
\r
22 {name: 'estimate', type: 'float'},
\r
23 {name: 'rate', type: 'float'},
\r
24 {name: 'cost', type: 'float'},
\r
25 {name: 'due', type: 'date', dateFormat:'m/d/Y'}
\r
30 // define a custom summary function
\r
31 Ext.grid.GroupSummary.Calculations['totalCost'] = function(v, record, field){
\r
32 return v + (record.data.estimate * record.data.rate);
\r
35 var summary = new Ext.grid.GroupSummary();
\r
37 var grid = new xg.EditorGridPanel({
\r
38 ds: new Ext.data.GroupingStore({
\r
41 sortInfo:{field: 'due', direction: "ASC"},
\r
42 groupField:'project'
\r
51 dataIndex: 'description',
\r
52 summaryType: 'count',
\r
54 summaryRenderer: function(v, params, data){
\r
55 return ((v === 0 || v > 1) ? '(' + v +' Tasks)' : '(1 Task)');
\r
57 editor: new Ext.form.TextField({
\r
64 dataIndex: 'project'
\r
71 renderer: Ext.util.Format.dateRenderer('m/d/Y'),
\r
72 editor: new Ext.form.DateField({
\r
79 dataIndex: 'estimate',
\r
81 renderer : function(v){
\r
84 editor: new Ext.form.NumberField({
\r
86 allowNegative: false,
\r
87 style: 'text-align:left'
\r
93 renderer: Ext.util.Format.usMoney,
\r
95 summaryType:'average',
\r
96 editor: new Ext.form.NumberField({
\r
98 allowNegative: false,
\r
99 style: 'text-align:left'
\r
107 renderer: function(v, params, record){
\r
108 return Ext.util.Format.usMoney(record.data.estimate * record.data.rate);
\r
111 summaryType:'totalCost',
\r
112 summaryRenderer: Ext.util.Format.usMoney
\r
116 view: new Ext.grid.GroupingView({
\r
118 showGroupName: false,
\r
119 enableNoGroups:false, // REQUIRED!
\r
120 hideGroupedColumn: true
\r
130 animCollapse: false,
\r
131 trackMouseOver: false,
\r
132 //enableColumnMove: false,
\r
133 title: 'Sponsored Projects',
\r
134 iconCls: 'icon-grid',
\r
135 renderTo: document.body
\r
139 Ext.grid.dummyProjects = [
\r
140 {projectId: 100, project: 'Ext Forms: Field Anchoring'},
\r
141 {projectId: 101, project: 'Ext Grid: Single-level Grouping'},
\r
142 {projectId: 102, project: 'Ext Grid: Summary Rows'}
\r
145 Ext.grid.dummyData = [
\r
146 {projectId: 100, project: 'Ext Forms: Field Anchoring', taskId: 112, description: 'Integrate 2.0 Forms with 2.0 Layouts', estimate: 6, rate: 150, due:'06/24/2007'},
\r
147 {projectId: 100, project: 'Ext Forms: Field Anchoring', taskId: 113, description: 'Implement AnchorLayout', estimate: 4, rate: 150, due:'06/25/2007'},
\r
148 {projectId: 100, project: 'Ext Forms: Field Anchoring', taskId: 114, description: 'Add support for multiple types of anchors', estimate: 4, rate: 150, due:'06/27/2007'},
\r
149 {projectId: 100, project: 'Ext Forms: Field Anchoring', taskId: 115, description: 'Testing and debugging', estimate: 8, rate: 0, due:'06/29/2007'},
\r
150 {projectId: 101, project: 'Ext Grid: Single-level Grouping', taskId: 101, description: 'Add required rendering "hooks" to GridView', estimate: 6, rate: 100, due:'07/01/2007'},
\r
151 {projectId: 101, project: 'Ext Grid: Single-level Grouping', taskId: 102, description: 'Extend GridView and override rendering functions', estimate: 6, rate: 100, due:'07/03/2007'},
\r
152 {projectId: 101, project: 'Ext Grid: Single-level Grouping', taskId: 103, description: 'Extend Store with grouping functionality', estimate: 4, rate: 100, due:'07/04/2007'},
\r
153 {projectId: 101, project: 'Ext Grid: Single-level Grouping', taskId: 121, description: 'Default CSS Styling', estimate: 2, rate: 100, due:'07/05/2007'},
\r
154 {projectId: 101, project: 'Ext Grid: Single-level Grouping', taskId: 104, description: 'Testing and debugging', estimate: 6, rate: 100, due:'07/06/2007'},
\r
155 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 105, description: 'Ext Grid plugin integration', estimate: 4, rate: 125, due:'07/01/2007'},
\r
156 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 106, description: 'Summary creation during rendering phase', estimate: 4, rate: 125, due:'07/02/2007'},
\r
157 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 107, description: 'Dynamic summary updates in editor grids', estimate: 6, rate: 125, due:'07/05/2007'},
\r
158 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 108, description: 'Remote summary integration', estimate: 4, rate: 125, due:'07/05/2007'},
\r
159 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 109, description: 'Summary renderers and calculators', estimate: 4, rate: 125, due:'07/06/2007'},
\r
160 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 110, description: 'Integrate summaries with GroupingView', estimate: 10, rate: 125, due:'07/11/2007'},
\r
161 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 111, description: 'Testing and debugging', estimate: 8, rate: 125, due:'07/15/2007'}
\r