← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7315: Added callbackName config option to table plugin to allow for caching

 

------------------------------------------------------------
revno: 7315
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-06-16 23:17:34 +0200
message:
  Added callbackName config option to table plugin to allow for caching
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/plugin.js
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/index.html


--
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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/plugin.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/plugin.js	2012-06-16 08:51:34 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/plugin.js	2012-06-16 21:17:34 +0000
@@ -723,8 +723,8 @@
 			DHIS.chart.value.getValues(project);
         },
         setState: function(conf) {
-            if (conf.uid) {
-                Ext.data.JsonP.request({
+            if (conf.uid) {            	
+            	var options = {
                     url: conf.url + DHIS.chart.conf.finals.ajax.favorite_get + conf.uid + '.jsonp',
                     scope: this,
                     disableCaching: false,
@@ -762,7 +762,13 @@
                         
                         this.getState(conf);                        
                     }
-                });
+                };
+                
+                if (DHIS.chart.util.value.isDefined(conf.callbackName)) {
+            	    options.callbackName = conf.callbackName;            	
+                }
+            
+                Ext.data.JsonP.request( options );
             }
         }
     };
@@ -1179,6 +1185,9 @@
 	getDynamicDataUrl: function(conf) {
 		var url = conf.url + DHIS.table.finals.dynamicDataGet + '.' + conf.format;
 		return this.getDataQuery(conf, url);
+	},
+	isDefined: function(variable) {
+		return (typeof(variable) !== 'undefined'); 
 	}
 };
 
@@ -1208,7 +1217,7 @@
 	},
 	render: function(conf) {
 		DHIS.table.utils.destroy(conf.el);
-		Ext.data.JsonP.request({
+		var options = {
 			url: DHIS.table.utils.getTableDataUrl(conf),
 			disableCaching: false,
 			success: function(data) {
@@ -1218,7 +1227,13 @@
 					renderTo: conf.el
 				});
 			}
-		});
+		};
+		
+        if (DHIS.table.utils.isDefined(conf.callbackName)) {
+        	options.callbackName = conf.callbackName;            	
+        }
+        
+		Ext.data.JsonP.request(options);
 	}
 };
 
@@ -1252,14 +1267,20 @@
 		return html;
 	},	
 	render: function(conf) {
-		Ext.data.JsonP.request({
+		var options = {
 			url: DHIS.table.utils.getTableDataUrl(conf),
 			disableCaching: false,
 			success: function(data) {
 				var html = DHIS.table.plain.getMarkup(conf, data);
 				Ext.get(conf.el).update(html);
 			}
-		});
+		};
+		
+        if (DHIS.table.utils.isDefined(conf.callbackName)) {
+        	options.callbackName = conf.callbackName;            	
+        }
+        
+		Ext.data.JsonP.request(options);
 	}
 };
 

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/index.html'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/index.html	2012-06-16 08:51:34 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/index.html	2012-06-16 21:17:34 +0000
@@ -26,6 +26,7 @@
 		
 			DHIS.getChart({
 				uid: 'UlfTKWZWV4u',
+				callbackName: 'chart1',
 				el: 'chart1',
 				url: url
 			});
@@ -85,6 +86,7 @@
 				orgUnitIsParent: true,
 				hiddenCols: [0],
 				useExtGrid: false,
+				callbackName: 'table1',
 				el: 'table1',
 				url: url
 			});