3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
18 'Ext.form.field.Number',
19 'Ext.form.field.Date',
20 'Ext.tip.QuickTipManager'
24 extend: 'Ext.data.Model',
27 {name: 'projectId', type: 'int'},
28 {name: 'project', type: 'string'},
29 {name: 'taskId', type: 'int'},
30 {name: 'description', type: 'string'},
31 {name: 'estimate', type: 'float'},
32 {name: 'rate', type: 'float'},
33 {name: 'cost', type: 'float'},
34 {name: 'due', type: 'date', dateFormat:'m/d/Y'}
39 {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'},
40 {projectId: 100, project: 'Ext Forms: Field Anchoring', taskId: 113, description: 'Implement AnchorLayout', estimate: 4, rate: 150, due:'06/25/2007'},
41 {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'},
42 {projectId: 100, project: 'Ext Forms: Field Anchoring', taskId: 115, description: 'Testing and debugging', estimate: 8, rate: 0, due:'06/29/2007'},
43 {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'},
44 {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'},
45 {projectId: 101, project: 'Ext Grid: Single-level Grouping', taskId: 103, description: 'Extend Store with grouping functionality', estimate: 4, rate: 100, due:'07/04/2007'},
46 {projectId: 101, project: 'Ext Grid: Single-level Grouping', taskId: 121, description: 'Default CSS Styling', estimate: 2, rate: 100, due:'07/05/2007'},
47 {projectId: 101, project: 'Ext Grid: Single-level Grouping', taskId: 104, description: 'Testing and debugging', estimate: 6, rate: 100, due:'07/06/2007'},
48 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 105, description: 'Ext Grid plugin integration', estimate: 4, rate: 125, due:'07/01/2007'},
49 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 106, description: 'Summary creation during rendering phase', estimate: 4, rate: 125, due:'07/02/2007'},
50 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 107, description: 'Dynamic summary updates in editor grids', estimate: 6, rate: 125, due:'07/05/2007'},
51 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 108, description: 'Remote summary integration', estimate: 4, rate: 125, due:'07/05/2007'},
52 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 109, description: 'Summary renderers and calculators', estimate: 4, rate: 125, due:'07/06/2007'},
53 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 110, description: 'Integrate summaries with GroupingView', estimate: 10, rate: 125, due:'07/11/2007'},
54 {projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 111, description: 'Testing and debugging', estimate: 8, rate: 125, due:'07/15/2007'}
57 Ext.onReady(function(){
59 Ext.tip.QuickTipManager.init();
61 var store = Ext.create('Ext.data.Store', {
64 sorters: {property: 'due', direction: 'ASC'},
68 var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
73 grid.getView().refresh();
77 var showSummary = true;
78 var grid = Ext.create('Ext.grid.Panel', {
82 title: 'Sponsored Projects',
84 renderTo: document.body,
86 plugins: [cellEditing],
91 tooltip: 'Toggle the visibility of the summary row',
92 text: 'Toggle Summary',
94 var view = grid.getView();
95 showSummary = !showSummary;
96 view.getFeature('group').toggleSummaryRow(showSummary);
103 ftype: 'groupingsummary',
104 groupHeaderTpl: '{name}',
105 hideGroupedHeader: true,
106 enableGroupingMenu: false
113 dataIndex: 'description',
115 summaryType: 'count',
116 summaryRenderer: function(value, summaryData, dataIndex) {
117 return ((value === 0 || value > 1) ? '(' + value + ' Tasks)' : '(1 Task)');
130 renderer: Ext.util.Format.dateRenderer('m/d/Y'),
131 summaryRenderer: Ext.util.Format.dateRenderer('m/d/Y'),
139 dataIndex: 'estimate',
141 renderer: function(value, metaData, record, rowIdx, colIdx, store, view){
142 return value + ' hours';
144 summaryRenderer: function(value, summaryData, dataIndex) {
145 return value + ' hours';
154 renderer: Ext.util.Format.usMoney,
155 summaryRenderer: Ext.util.Format.usMoney,
157 summaryType: 'average',
167 renderer: function(value, metaData, record, rowIdx, colIdx, store, view) {
168 return Ext.util.Format.usMoney(record.get('estimate') * record.get('rate'));
171 summaryType: function(records){
173 length = records.length,
177 for (; i < length; ++i) {
179 total += record.get('estimate') * record.get('rate');
183 summaryRenderer: Ext.util.Format.usMoney