PageRenderTime 29ms CodeModel.GetById 18ms app.highlight 9ms RepoModel.GetById 0ms app.codeStats 0ms

/ext-4.1.0_b3/examples/grid/remote-group-summary-grid-simjax.js

https://bitbucket.org/srogerf/javascript
JavaScript | 51 lines | 43 code | 5 blank | 3 comment | 1 complexity | 9ef9901a2b52c20be6c759431d1690c5 MD5 | raw file
 1Ext.Loader.setConfig({ enabled: true });
 2Ext.Loader.setPath('Ext.ux', '../ux');
 3
 4Ext.require([
 5    'Ext.ux.ajax.SimManager'
 6]);
 7
 8/*
 9 * Setup our faux Ajax response "simlet".
10 */
11function initAjaxSim () {
12    Ext.ux.ajax.SimManager.register({
13        'remote-group-summary-grid.php' : {
14            stype: 'json',
15
16            data: [
17                {projectId: 100, project: 'Forms: Field Anchoring', taskId: 112, description: 'Integrate 2.0 Forms with 2.0 Layouts', estimate: 6, rate: 150, due:'06/24/2007'},
18                {projectId: 100, project: 'Forms: Field Anchoring', taskId: 113, description: 'Implement AnchorLayout', estimate: 4, rate: 150, due:'06/25/2007'},
19                {projectId: 100, project: 'Forms: Field Anchoring', taskId: 114, description: 'Add support for multiple types of anchors', estimate: 4, rate: 150, due:'06/27/2007'},
20                {projectId: 100, project: 'Forms: Field Anchoring', taskId: 115, description: 'Testing and debugging', estimate: 8, rate: 0, due:'06/29/2007'},
21                {projectId: 101, project: 'Grid: Single-level Grouping', taskId: 101, description: 'Add required rendering "hooks" to GridView', estimate: 6, rate: 100, due:'07/01/2007'},
22                {projectId: 101, project: 'Grid: Single-level Grouping', taskId: 102, description: 'Extend GridView and override rendering functions', estimate: 6, rate: 100, due:'07/03/2007'},
23                {projectId: 101, project: 'Grid: Single-level Grouping', taskId: 103, description: 'Extend Store with grouping functionality', estimate: 4, rate: 100, due:'07/04/2007'},
24                {projectId: 101, project: 'Grid: Single-level Grouping', taskId: 121, description: 'Default CSS Styling', estimate: 2, rate: 100, due:'07/05/2007'},
25                {projectId: 101, project: 'Grid: Single-level Grouping', taskId: 104, description: 'Testing and debugging', estimate: 6, rate: 100, due:'07/06/2007'},
26                {projectId: 102, project: 'Grid: Summary Rows', taskId: 105, description: 'Ext Grid plugin integration', estimate: 4, rate: 125, due:'07/01/2007'},
27                {projectId: 102, project: 'Grid: Summary Rows', taskId: 106, description: 'Summary creation during rendering phase', estimate: 4, rate: 125, due:'07/02/2007'},
28                {projectId: 102, project: 'Grid: Summary Rows', taskId: 107, description: 'Dynamic summary updates in editor grids', estimate: 6, rate: 125, due:'07/05/2007'},
29                {projectId: 102, project: 'Grid: Summary Rows', taskId: 108, description: 'Remote summary integration', estimate: 4, rate: 125, due:'07/05/2007'},
30                {projectId: 102, project: 'Grid: Summary Rows', taskId: 109, description: 'Summary renderers and calculators', estimate: 4, rate: 125, due:'07/06/2007'},
31                {projectId: 102, project: 'Grid: Summary Rows', taskId: 110, description: 'Integrate summaries with GroupingView', estimate: 10, rate: 125, due:'07/11/2007'},
32                {projectId: 102, project: 'Grid: Summary Rows', taskId: 111, description: 'Testing and debugging', estimate: 8, rate: 125, due:'07/15/2007'}
33            ],
34
35            getGroupSummary: function (groupField, rows, ctx) {
36                var ret = Ext.apply({}, rows[0]);
37                ret.cost = 0;
38                ret.estimate = 0;
39                Ext.each(rows, function (row) {
40                    ret.estimate += row.estimate;
41                    ret.cost += row.estimate * row.rate;
42                });
43                ret.estimate *= -1;
44                ret.cost *= -1;
45                return ret;
46            }
47        }
48    });
49}
50
51Ext.onReady(initAjaxSim);