← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22186: PT DV data items store fix.

 

------------------------------------------------------------
revno: 22186
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-03-08 11:37:16 +0100
message:
  PT DV data items store fix.
modified:
  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-pivot/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js	2016-03-02 13:27:03 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js	2016-03-08 10:37:16 +0000
@@ -2869,7 +2869,13 @@
             },
             loadDataAndUpdate: function(data, append) {
                 this.clearFilter(); // work around
+
+                if (!append) {
+                    this.removeAll();
+                }
+
                 this.loadData(data, append);
+
                 this.updateFilter();
             },
             getRecordsByIds: function(ids) {
@@ -3028,7 +3034,13 @@
             },
             loadDataAndUpdate: function(data, append) {
                 this.clearFilter(); // work around
+
+                if (!append) {
+                    this.removeAll();
+                }
+
                 this.loadData(data, append);
+
                 this.updateFilter();
             },
             getRecordsByIds: function(ids) {
@@ -3348,7 +3360,13 @@
 			},
             loadDataAndUpdate: function(data, append) {
                 this.clearFilter(); // work around
+
+                if (!append) {
+                    this.removeAll();
+                }
+
                 this.loadData(data, append);
+
                 this.updateFilter();
             },
             getRecordsByIds: function(ids) {
@@ -3386,7 +3404,13 @@
 			},
             loadDataAndUpdate: function(data, append) {
                 this.clearFilter(); // work around
+
+                if (!append) {
+                    this.removeAll();
+                }
+
                 this.loadData(data, append);
+
                 this.updateFilter();
             },
             getRecordsByIds: function(ids) {
@@ -4464,9 +4488,7 @@
                             var attributes = (Ext.decode(r.responseText).programs[0] || {}).programTrackedEntityAttributes || [],
                                 data = ns.core.support.prototype.array.sort(Ext.Array.clean([].concat(elements, attributes))) || [];
 
-                            if (data) {
-                                eventDataItemAvailableStore.loadDataAndUpdate(data);
-                            }
+                            eventDataItemAvailableStore.loadDataAndUpdate(data);
                         }
                     });
                 }
@@ -4708,9 +4730,7 @@
                     var indicators = (Ext.decode(r.responseText).programs[0] || {}).programIndicators || [],
                         data = ns.core.support.prototype.array.sort(indicators);
 
-                    if (data) {
-                        programIndicatorAvailableStore.loadDataAndUpdate(data);
-                    }
+                    programIndicatorAvailableStore.loadDataAndUpdate(data);
                 }
             });
 

=== 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	2016-03-02 13:27:03 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js	2016-03-08 10:37:16 +0000
@@ -2948,7 +2948,13 @@
             },
             loadDataAndUpdate: function(data, append) {
                 this.clearFilter(); // work around
+
+                if (!append) {
+                    this.removeAll();
+                }
+
                 this.loadData(data, append);
+
                 this.updateFilter();
             },
             getRecordsByIds: function(ids) {
@@ -3107,7 +3113,13 @@
             },
             loadDataAndUpdate: function(data, append) {
                 this.clearFilter(); // work around
+
+                if (!append) {
+                    this.removeAll();
+                }
+
                 this.loadData(data, append);
+
                 this.updateFilter();
             },
             getRecordsByIds: function(ids) {
@@ -3427,7 +3439,13 @@
 			},
             loadDataAndUpdate: function(data, append) {
                 this.clearFilter(); // work around
+
+                if (!append) {
+                    this.removeAll();
+                }
+
                 this.loadData(data, append);
+
                 this.updateFilter();
             },
             getRecordsByIds: function(ids) {
@@ -3465,7 +3483,13 @@
 			},
             loadDataAndUpdate: function(data, append) {
                 this.clearFilter(); // work around
+
+                if (!append) {
+                    this.removeAll();
+                }
+
                 this.loadData(data, append);
+
                 this.updateFilter();
             },
             getRecordsByIds: function(ids) {
@@ -3713,8 +3737,6 @@
                 dataSet.hide();
                 eventDataItem.hide();
                 programIndicator.hide();
-
-                //dataSelected.show();
             }
             else if (type === 'de') {
                 indicator.hide();
@@ -3776,7 +3798,7 @@
                 data: [
                      {id: 'in', name: NS.i18n.indicators},
                      {id: 'de', name: NS.i18n.data_elements},
-                     {id: 'ds', name: NS.i18n.data_sets},
+                     {id: 'ds', name: NS.i18n.reporting_rates},
                      {id: 'di', name: NS.i18n.event_data_items},
                      {id: 'pi', name: NS.i18n.program_indicators}
                 ]
@@ -4531,9 +4553,7 @@
                             var attributes = (Ext.decode(r.responseText).programs[0] || {}).programTrackedEntityAttributes || [],
                                 data = ns.core.support.prototype.array.sort(Ext.Array.clean([].concat(elements, attributes))) || [];
 
-                            if (data) {
-                                eventDataItemAvailableStore.loadDataAndUpdate(data);
-                            }
+                            eventDataItemAvailableStore.loadDataAndUpdate(data);
                         }
                     });
                 }
@@ -4763,21 +4783,17 @@
         // program indicator
         onProgramIndicatorProgramSelect = function(programId, skipSync) {
             if (!skipSync) {
-                dataSelectedStore.removeByProperty('objectName', ['di','pi']);
+                //dataSelectedStore.removeByProperty('objectName', ['di','pi']);
                 eventDataItemProgram.setValue(programId);
                 onEventDataItemProgramSelect(programId, true);
             }
 
             Ext.Ajax.request({
-                url: ns.core.init.contextPath + '/api/programs.json?filter=id:eq:' + programId + '&fields=programIndicators[id,' + namePropertyUrl + ']&paging=false',
-                success: function(r) {
-                    r = Ext.decode(r.responseText);
-
-                    var isA = Ext.isArray,
-                        isO = Ext.isObject,
-                        program = isA(r.programs) && r.programs.length ? r.programs[0] : null,
-                        programIndicators = isO(program) && isA(program.programIndicators) && program.programIndicators.length ? program.programIndicators : [],
-                        data = ns.core.support.prototype.array.sort(Ext.Array.clean(programIndicators)) || [];
+                url: ns.core.init.contextPath + '/api/programs.json?filter=id:eq:' + programId + '&fields=programIndicators[dimensionItem|rename(id),' + namePropertyUrl + ']&paging=false',
+				disableCaching: false,
+				success: function(r) {
+                    var indicators = (Ext.decode(r.responseText).programs[0] || {}).programIndicators || [],
+                        data = ns.core.support.prototype.array.sort(indicators);
 
                     programIndicatorAvailableStore.loadDataAndUpdate(data);
                 }
@@ -4792,6 +4808,7 @@
 			displayField: 'name',
 			emptyText: NS.i18n.select_program,
 			editable: false,
+            queryMode: 'local',
 			store: programStore,
 			listeners: {
 				select: function(cb) {