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
21 {name: 'projectId', type: 'int'},
\r
22 {name: 'project', type: 'string'},
\r
23 {name: 'taskId', type: 'int'},
\r
24 {name: 'description', type: 'string'},
\r
25 {name: 'estimate', type: 'float'},
\r
26 {name: 'rate', type: 'float'},
\r
27 {name: 'cost', type: 'float'},
\r
28 {name: 'due', type: 'date', dateFormat:'m/d/Y'}
\r
33 // define a custom summary function
\r
34 Ext.grid.GroupSummary.Calculations['totalCost'] = function(v, record, field){
\r
35 return v + (record.data.estimate * record.data.rate);
\r
38 var summary = new Ext.grid.HybridSummary();
\r
40 var grid = new xg.EditorGridPanel({
\r
41 ds: new Ext.data.GroupingStore({
\r
43 proxy : new Ext.data.HttpProxy({
\r
44 url: 'summary.json',
\r
47 sortInfo:{field: 'due', direction: "ASC"},
\r
48 groupField:'project'
\r
57 dataIndex: 'description',
\r
58 summaryType: 'count',
\r
60 summaryRenderer: function(v, params, data){
\r
61 return ((v === 0 || v > 1) ? '(' + v +' Tasks)' : '(1 Task)');
\r
63 editor: new Ext.form.TextField({
\r
70 dataIndex: 'project'
\r
77 renderer: Ext.util.Format.dateRenderer('m/d/Y'),
\r
78 editor: new Ext.form.DateField({
\r
85 dataIndex: 'estimate',
\r
87 renderer : function(v){
\r
90 editor: new Ext.form.NumberField({
\r
92 allowNegative: false,
\r
93 style: 'text-align:left'
\r
99 renderer: Ext.util.Format.usMoney,
\r
101 summaryType:'average',
\r
102 editor: new Ext.form.NumberField({
\r
104 allowNegative: false,
\r
105 style: 'text-align:left'
\r
113 renderer: function(v, params, record){
\r
114 return Ext.util.Format.usMoney(record.data.estimate * record.data.rate);
\r
117 summaryType:'totalCost',
\r
118 summaryRenderer: Ext.util.Format.usMoney
\r
122 view: new Ext.grid.GroupingView({
\r
124 showGroupName: false,
\r
125 hideGroupedColumn: true
\r
132 handler: function(){summary.toggleSummaries();}
\r
140 animCollapse: false,
\r
141 trackMouseOver: false,
\r
142 //enableColumnMove: false,
\r
143 title: 'Sponsored Projects',
\r
144 iconCls: 'icon-grid',
\r
145 renderTo: document.body
\r
148 grid.on('afteredit', function(){
\r
149 var groupValue = 'Ext Forms: Field Anchoring';
\r
150 summary.showSummaryMsg(groupValue, 'Updating Summary...');
\r
151 setTimeout(function(){ // simulate server call
\r
152 summary.updateSummaryData(groupValue,
\r
153 {due: new Date(2007, 6, 29), estimate: 21, rate: 185, cost: 2900});
\r
160 Ext.grid.dummyProjects = [
\r
161 {projectId: 100, project: 'Ext Forms: Field Anchoring'},
\r
162 {projectId: 101, project: 'Ext Grid: Single-level Grouping'},
\r
163 {projectId: 102, project: 'Ext Grid: Summary Rows'}
\r
166 Ext.grid.dummyData = [
\r
167 {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
168 {projectId: 100, project: 'Ext Forms: Field Anchoring', taskId: 113, description: 'Implement AnchorLayout', estimate: 4, rate: 150, due:'06/25/2007'},
\r
169 {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
170 {projectId: 100, project: 'Ext Forms: Field Anchoring', taskId: 115, description: 'Testing and debugging', estimate: 8, rate: 0, due:'06/29/2007'},
\r
171 {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
172 {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
173 {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
174 {projectId: 101, project: 'Ext Grid: Single-level Grouping', taskId: 121, description: 'Default CSS Styling', estimate: 2, rate: 100, due:'07/05/2007'},
\r
175 {projectId: 101, project: 'Ext Grid: Single-level Grouping', taskId: 104, description: 'Testing and debugging', estimate: 6, rate: 100, due:'07/06/2007'},
\r
176 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 105, description: 'Ext Grid plugin integration', estimate: 4, rate: 125, due:'07/01/2007'},
\r
177 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 106, description: 'Summary creation during rendering phase', estimate: 4, rate: 125, due:'07/02/2007'},
\r
178 {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
179 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 108, description: 'Remote summary integration', estimate: 4, rate: 125, due:'07/05/2007'},
\r
180 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 109, description: 'Summary renderers and calculators', estimate: 4, rate: 125, due:'07/06/2007'},
\r
181 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 110, description: 'Integrate summaries with GroupingView', estimate: 10, rate: 125, due:'07/11/2007'},
\r
182 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 111, description: 'Testing and debugging', estimate: 8, rate: 125, due:'07/15/2007'}
\r