dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #43242
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21962: data-entry: bug fix in saving option set
------------------------------------------------------------
revno: 21962
committer: Abyot Asalefew Gizaw <abyot@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2016-02-13 21:57:05 +0100
message:
data-entry: bug fix in saving option set
modified:
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/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2016-01-30 11:20:58 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2016-02-13 20:57:05 +0000
@@ -591,20 +591,6 @@
} );
} );
- $( '.entryoptionset' ).each( function( i )
- {
- var id = $( this ).attr( 'id' );
- var split = dhis2.de.splitFieldId( id );
-
- var dataElementId = split.dataElementId;
- var optionComboId = split.optionComboId;
-
- $( this ).change( function()
- {
- saveVal( dataElementId, optionComboId, id );
- } );
- } );
-
$( '.commentlink' ).each( function( i )
{
var id = $( this ).attr( 'id' );
@@ -1530,6 +1516,8 @@
$fields.find( '.upload-field' ).css( 'background-color', dhis2.de.cst.colorWhite );
$fields.find( 'input' ).val( '' );
+
+ $('.select2-container').select2("val", "");
}
function getAndInsertDataValues()
@@ -3034,6 +3022,14 @@
dhis2.de.insertOptionSets = function()
{
$( '.entryoptionset').each( function( idx, item ) {
+
+ var fieldId = item.id;
+
+ var split = dhis2.de.splitFieldId( fieldId );
+
+ var dataElementId = split.dataElementId;
+ var optionComboId = split.optionComboId;
+
var optionSetKey = dhis2.de.splitFieldId( item.id );
var s2prefix = 's2id_';
optionSetKey.dataElementId = optionSetKey.dataElementId.indexOf(s2prefix) != -1 ? optionSetKey.dataElementId.substring(s2prefix.length, optionSetKey.dataElementId.length) : optionSetKey.dataElementId;
@@ -3048,7 +3044,6 @@
item = item + '-val';
optionSetKey = optionSetKey.dataElementId + '-' + optionSetKey.optionComboId;
var optionSetUid = dhis2.de.optionSets[optionSetKey].uid;
- //dhis2.de.autocompleteOptionSetField( item, optionSetUid );
DAO.store.get( 'optionSets', optionSetUid ).done( function( obj ) {
if ( obj && obj.optionSet && obj.optionSet.options ) {
@@ -3063,9 +3058,8 @@
allowClear: true,
dataType: 'json',
data: obj.optionSet.options
- }).on("select2:unselecting", function (e) {
- $(this).select2("val", "");
- e.preventDefault();
+ }).on("change", function(e){
+ saveVal( dataElementId, optionComboId, fieldId );
});
}
} );