← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18020: Ext tree store override.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 18020 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-01-16 13:45:58 +0100
message:
  Ext tree store override.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js	2014-12-02 16:00:36 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js	2015-01-16 12:43:38 +0000
@@ -18,7 +18,6 @@
 		};
 
 	// set app config
-
 	(function() {
 
 		// ext configuration
@@ -64,6 +63,42 @@
 
         });
 
+        Ext.override(Ext.data.TreeStore, {
+            load: function(options) {
+                options = options || {};
+                options.params = options.params || {};
+
+                var me = this,
+                    node = options.node || me.tree.getRootNode(),
+                    root;
+
+                // If there is not a node it means the user hasnt defined a rootnode yet. In this case lets just
+                // create one for them.
+                if (!node) {
+                    node = me.setRootNode({
+                        expanded: true
+                    });
+                }
+
+                if (me.clearOnLoad) {
+                    node.removeAll(true);
+                }
+
+                options.records = [node];
+
+                Ext.applyIf(options, {
+                    node: node
+                });
+                //options.params[me.nodeParam] = node ? node.getId() : 'root';
+
+                if (node) {
+                    node.set('loading', true);
+                }
+
+                return me.callParent([options]);
+            }
+        });
+
 		// right click handler
 		document.body.oncontextmenu = function() {
 			return false;

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js	2014-12-02 16:00:36 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js	2015-01-16 12:43:38 +0000
@@ -17,7 +17,6 @@
 		};
 
 	// set app config
-
 	(function() {
 
 		// ext configuration
@@ -63,6 +62,42 @@
 
         });
 
+        Ext.override(Ext.data.TreeStore, {
+            load: function(options) {
+                options = options || {};
+                options.params = options.params || {};
+
+                var me = this,
+                    node = options.node || me.tree.getRootNode(),
+                    root;
+
+                // If there is not a node it means the user hasnt defined a rootnode yet. In this case lets just
+                // create one for them.
+                if (!node) {
+                    node = me.setRootNode({
+                        expanded: true
+                    });
+                }
+
+                if (me.clearOnLoad) {
+                    node.removeAll(true);
+                }
+
+                options.records = [node];
+
+                Ext.applyIf(options, {
+                    node: node
+                });
+                //options.params[me.nodeParam] = node ? node.getId() : 'root';
+
+                if (node) {
+                    node.set('loading', true);
+                }
+
+                return me.callParent([options]);
+            }
+        });
+
 		// right click handler
 		document.body.oncontextmenu = function() {
 			return false;

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js	2015-01-14 14:56:08 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js	2015-01-16 12:43:38 +0000
@@ -49,6 +49,42 @@
 
         });
 
+        Ext.override(Ext.data.TreeStore, {
+            load: function(options) {
+                options = options || {};
+                options.params = options.params || {};
+
+                var me = this,
+                    node = options.node || me.tree.getRootNode(),
+                    root;
+
+                // If there is not a node it means the user hasnt defined a rootnode yet. In this case lets just
+                // create one for them.
+                if (!node) {
+                    node = me.setRootNode({
+                        expanded: true
+                    });
+                }
+
+                if (me.clearOnLoad) {
+                    node.removeAll(true);
+                }
+
+                options.records = [node];
+
+                Ext.applyIf(options, {
+                    node: node
+                });
+                //options.params[me.nodeParam] = node ? node.getId() : 'root';
+
+                if (node) {
+                    node.set('loading', true);
+                }
+
+                return me.callParent([options]);
+            }
+        });
+
 		// right click handler
 		document.body.oncontextmenu = function() {
 			return false;

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js	2014-12-04 13:52:55 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js	2015-01-16 12:43:38 +0000
@@ -62,6 +62,42 @@
 
         });
 
+        Ext.override(Ext.data.TreeStore, {
+            load: function(options) {
+                options = options || {};
+                options.params = options.params || {};
+
+                var me = this,
+                    node = options.node || me.tree.getRootNode(),
+                    root;
+
+                // If there is not a node it means the user hasnt defined a rootnode yet. In this case lets just
+                // create one for them.
+                if (!node) {
+                    node = me.setRootNode({
+                        expanded: true
+                    });
+                }
+
+                if (me.clearOnLoad) {
+                    node.removeAll(true);
+                }
+
+                options.records = [node];
+
+                Ext.applyIf(options, {
+                    node: node
+                });
+                //options.params[me.nodeParam] = node ? node.getId() : 'root';
+
+                if (node) {
+                    node.set('loading', true);
+                }
+
+                return me.callParent([options]);
+            }
+        });
+
 		// right click handler
 		document.body.oncontextmenu = function() {
 			return false;

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js	2014-12-02 16:00:36 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js	2015-01-16 12:43:38 +0000
@@ -62,6 +62,42 @@
 
         });
 
+        Ext.override(Ext.data.TreeStore, {
+            load: function(options) {
+                options = options || {};
+                options.params = options.params || {};
+
+                var me = this,
+                    node = options.node || me.tree.getRootNode(),
+                    root;
+
+                // If there is not a node it means the user hasnt defined a rootnode yet. In this case lets just
+                // create one for them.
+                if (!node) {
+                    node = me.setRootNode({
+                        expanded: true
+                    });
+                }
+
+                if (me.clearOnLoad) {
+                    node.removeAll(true);
+                }
+
+                options.records = [node];
+
+                Ext.applyIf(options, {
+                    node: node
+                });
+                //options.params[me.nodeParam] = node ? node.getId() : 'root';
+
+                if (node) {
+                    node.set('loading', true);
+                }
+
+                return me.callParent([options]);
+            }
+        });
+
 		// right click handler
 		document.body.oncontextmenu = function() {
 			return false;