← Back to team overview

dhis2-devs team mailing list archive

Re: JavaScript onValueLoad for Datasets?

 

Thanks Morten, that was exactly what I needed! Works like a charm.

Timothy Harding
PeaceCorps Volunteer
Republic of Vanuatu
hardingt@xxxxxxxxx
+678 5955137

On Fri, Oct 24, 2014 at 5:25 PM, Morten Olav Hansen <mortenoh@xxxxxxxxx>
wrote:

> Hi
>
> If I understand you correctly, you can use
> "dhis2.de.event.dataValuesLoaded" event, which is triggered on the document
> when all previous data values are loaded.
>
>   $(document).on('dhis2.de.event.dataValuesLoaded', function(e) {} );
>
> --
> Morten
>
> On Fri, Oct 24, 2014 at 12:21 PM, Timothy Harding <hardingt@xxxxxxxxx>
> wrote:
>
>> Hello all,
>>
>> Looking at the manual, we've got two functions we can use inside the
>> datasets, If I use an alert
>> like: alert($("#Zdx2UHSluH7-efg0iPzSOl7-val").val());
>>
>>
>>    - onFormLoad - This functions looks to occur before data values are
>>    populated from past data entry activities, so the alert box is empty
>>    - onValueSave - This function looks occur when a value is
>>    entered/modified, but it does not if the value has already
>>    been entered from a previous data entry session
>>
>>
>> Is there function that will fire when a datavalue is populated from the
>> database? Any other ideas?
>>
>> I had an idea to do the following:
>>
>> http://apps.dhis2.org/demo/api/dataValueSets.xml?dataSet=C2lyrnptn5H&period=201403&orgUnit=k06A6pVmlFq
>> with an xml parser in javascript, but that seems to be overkill, just
>> need the value from one dataelement
>>
>>
>> Timothy Harding
>> PeaceCorps Volunteer
>> Republic of Vanuatu
>> hardingt@xxxxxxxxx
>> +678 5955137
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>

References