dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31740
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16213: Data entry, improved performance on updating data element totals
------------------------------------------------------------
revno: 16213
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-07-23 11:08:11 +0200
message:
Data entry, improved performance on updating data element totals
modified:
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.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-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js 2014-07-23 06:59:30 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js 2014-07-23 09:08:11 +0000
@@ -19,7 +19,13 @@
var SEPARATOR = '.';
var EVENT_VALUE_SAVED = 'dhis-web-dataentry-value-saved';
-function updateDataElementTotals()
+/**
+ * Updates totals for data element total fields.
+ *
+ * @param dataElementId the id of the data element to update total fields, if
+ * omitted then all total fields are updated.
+ */
+dhis2.de.updateDataElementTotals = function( dataElementId )
{
var currentTotals = [];
@@ -27,9 +33,12 @@
{
var de = $( this ).attr( 'dataelementid' );
- var total = dhis2.de.getDataElementTotalValue( de );
-
- $( this ).attr( 'value', total );
+ if ( !dataElementId || dataElementId == de )
+ {
+ var total = dhis2.de.getDataElementTotalValue( de );
+
+ $( this ).attr( 'value', total );
+ }
} );
}
@@ -37,7 +46,7 @@
* Updates all indicator input fields with the calculated value based on the
* values in the input entry fields in the form.
*/
-function updateIndicators()
+dhis2.de.updateIndicators = function()
{
$( 'input[name="indicator"]' ).each( function( index )
{
@@ -247,8 +256,8 @@
var valueSaver = new ValueSaver( dataElementId, periodId, optionComboId, value, fieldId, color );
valueSaver.save();
- updateIndicators(); // Update indicators for custom form
- updateDataElementTotals(); // Update data element totals for custom forms
+ dhis2.de.updateIndicators(); // Update indicators for custom form
+ dhis2.de.updateDataElementTotals( dataElementId ); // Update data element totals for custom forms
if ( warning )
{
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2014-07-21 11:02:11 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2014-07-23 09:08:11 +0000
@@ -1468,8 +1468,8 @@
// Update indicator values in form
- updateIndicators();
- updateDataElementTotals();
+ dhis2.de.updateIndicators();
+ dhis2.de.updateDataElementTotals();
// Set completeness button