3 * Copyright(c) 2006-2009 Ext JS, LLC
5 * http://www.extjs.com/license
7 Ext.onReady(function(){
\r
9 Ext.QuickTips.init();
\r
13 var reader = new Ext.data.JsonReader({
\r
14 idProperty: 'taskId',
\r
16 {name: 'projectId', type: 'int'},
\r
17 {name: 'project', type: 'string'},
\r
18 {name: 'taskId', type: 'int'},
\r
19 {name: 'description', type: 'string'},
\r
20 {name: 'estimate', type: 'float'},
\r
21 {name: 'rate', type: 'float'},
\r
22 {name: 'cost', type: 'float'},
\r
23 {name: 'due', type: 'date', dateFormat:'m/d/Y'}
\r
28 // define a custom summary function
\r
29 Ext.ux.grid.GroupSummary.Calculations['totalCost'] = function(v, record, field){
\r
30 return v + (record.data.estimate * record.data.rate);
\r
33 // utilize custom extension for Group Summary
\r
34 var summary = new Ext.ux.grid.GroupSummary();
\r
36 var grid = new xg.EditorGridPanel({
\r
37 ds: new Ext.data.GroupingStore({
\r
40 data: app.grid.dummyData,
\r
41 sortInfo: {field: 'due', direction: 'ASC'},
\r
42 groupField: 'project'
\r
50 dataIndex: 'description',
\r
51 summaryType: 'count',
\r
53 summaryRenderer: function(v, params, data){
\r
54 return ((v === 0 || v > 1) ? '(' + v +' Tasks)' : '(1 Task)');
\r
56 editor: new Ext.form.TextField({
\r
63 dataIndex: 'project'
\r
70 renderer: Ext.util.Format.dateRenderer('m/d/Y'),
\r
71 editor: new Ext.form.DateField({
\r
78 dataIndex: 'estimate',
\r
80 renderer : function(v){
\r
83 editor: new Ext.form.NumberField({
\r
85 allowNegative: false,
\r
86 style: 'text-align:left'
\r
92 renderer: Ext.util.Format.usMoney,
\r
94 summaryType: 'average',
\r
95 editor: new Ext.form.NumberField({
\r
97 allowNegative: false,
\r
98 style: 'text-align:left'
\r
106 renderer: function(v, params, record){
\r
107 return Ext.util.Format.usMoney(record.data.estimate * record.data.rate);
\r
110 summaryType: 'totalCost',
\r
111 summaryRenderer: Ext.util.Format.usMoney
\r
115 view: new Ext.grid.GroupingView({
\r
117 showGroupName: false,
\r
118 enableNoGroups: false,
\r
119 enableGroupingMenu: false,
\r
120 hideGroupedColumn: true
\r
127 tooltip: 'Toggle the visibility of summary row',
\r
128 handler: function(){summary.toggleSummaries();}
\r
136 animCollapse: false,
\r
137 trackMouseOver: false,
\r
138 //enableColumnMove: false,
\r
139 title: 'Sponsored Projects',
\r
140 iconCls: 'icon-grid',
\r
141 renderTo: document.body
\r
146 // set up namespace for application
\r
147 Ext.ns('app.grid');
\r
148 // store dummy data in the app namespace
\r
149 app.grid.dummyData = [
\r
150 {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
151 {projectId: 100, project: 'Ext Forms: Field Anchoring', taskId: 113, description: 'Implement AnchorLayout', estimate: 4, rate: 150, due:'06/25/2007'},
\r
152 {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
153 {projectId: 100, project: 'Ext Forms: Field Anchoring', taskId: 115, description: 'Testing and debugging', estimate: 8, rate: 0, due:'06/29/2007'},
\r
154 {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
155 {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
156 {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
157 {projectId: 101, project: 'Ext Grid: Single-level Grouping', taskId: 121, description: 'Default CSS Styling', estimate: 2, rate: 100, due:'07/05/2007'},
\r
158 {projectId: 101, project: 'Ext Grid: Single-level Grouping', taskId: 104, description: 'Testing and debugging', estimate: 6, rate: 100, due:'07/06/2007'},
\r
159 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 105, description: 'Ext Grid plugin integration', estimate: 4, rate: 125, due:'07/01/2007'},
\r
160 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 106, description: 'Summary creation during rendering phase', estimate: 4, rate: 125, due:'07/02/2007'},
\r
161 {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
162 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 108, description: 'Remote summary integration', estimate: 4, rate: 125, due:'07/05/2007'},
\r
163 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 109, description: 'Summary renderers and calculators', estimate: 4, rate: 125, due:'07/06/2007'},
\r
164 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 110, description: 'Integrate summaries with GroupingView', estimate: 10, rate: 125, due:'07/11/2007'},
\r
165 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 111, description: 'Testing and debugging', estimate: 8, rate: 125, due:'07/15/2007'}
\r