← Back to team overview

dhis2-devs team mailing list archive

Re: Optionset api not returning the name and code v2.26

 

Hi Morton

Thanks for the update but the issue is happening when I try to add a
comment on the DataEntry form.(I used the api call to confirm the response)
.
>From what you saying then this needs to be changed on the from.js on the
DataEntry in this piece of the code from line 3040

/**
 * Retrieves options from server. Provides result as jquery ui structure to
the
 * given jquery ui success callback.
 */
dhis2.de.getOptions = function( uid, query, success )
{
    return $.ajax( {
        url: '../api/optionSets/' + uid + '.json?links=false&q=' + query,
        dataType: "json",
        cache: false,
        type: 'GET',
        success: function ( data ) {
            success( $.map( data.options, function ( item ) {
                return {
                    label: item.name,
                    id: item.code
                };
            } ) );
        }
    } );


Regards
Pooben

On Thu, Jun 15, 2017 at 9:39 AM, Morten Olav Hansen <morten@xxxxxxxxx>
wrote:

> Hi Pooben
>
> Yes, this was changed some time back. Please have a look at our field
> filter docs [1]. For collections list this, the default field filter is
> just the id, but you can easily get more by doing `options[:all]` or by
> being more specific `options[id,displayName]`.
>
> [1] https://docs.dhis2.org/master/en/developer/html/
> webapi_metadata_field_filter.html
>
> --
> Morten Olav Hansen
> Senior Engineer, DHIS 2
> University of Oslo
> http://www.dhis2.org
>
> On Thu, Jun 15, 2017 at 2:28 PM, Pooben Dass <pooben@xxxxxxxx> wrote:
>
>> Hi
>>
>> We have a dropdown list of comment options linked to the dataelements as
>> option set comments but the drop down populates as undefined.
>>
>> Upon checking the api (/api/optionSets/) to confirm what is returned, I
>> see it only returns the id not the other values.
>>
>> this is what is returned in v2.26:
>> options:
>> [
>>
>>    -
>>    {
>>       - id: "AMrXb7wAiKV"
>>       },
>>    -
>>    {
>>       - id: "yCLGIfdYbQ4"
>>       },
>>
>>
>>
>> this is what is returned in v2.20:
>> options:
>> [
>>
>>    -
>>    {
>>       - id: "AMrXb7wAiKV",
>>       - name: "#{1} No evidence",
>>       - code: "#{1} No evidence",
>>       - created: "2015-03-09T19:33:15.000+0000",
>>       - lastUpdated: "2015-03-09T19:33:15.000+0000",
>>       - href: "url ...."
>>       },
>>    -
>>    {
>>       - id: "yCLGIfdYbQ4",
>>       - name: "#{2} Evidence not valid/irrelevant",
>>       - code: "#{2} Evidence not valid/irrelevant",
>>       - created: "2015-03-09T19:33:15.000+0000",
>>       - lastUpdated: "2015-03-09T19:33:15.000+0000",
>>       - href: "url ....."
>>       },
>>
>>
>> Is there a script that was neglected in the upgrade process or some other
>> setting that needs to be changed?
>>
>> Regards
>> Pooben
>>
>> *This message and any attachments are subject to a disclaimer published
>> at http://www.hisp.org/policies.html#comms_disclaimer
>> <http://www.hisp.org/policies.html#comms_disclaimer>.  Please read the
>> disclaimer before opening any attachment or taking any other action in
>> terms of this electronic transmission.  If you cannot access the
>> disclaimer, kindly send an email to disclaimer@xxxxxxxx
>> <disclaimer@xxxxxxxx> and a copy will be provided to you. By replying to
>> this e-mail or opening any attachment you agree to be bound by the
>> provisions of the disclaimer.*
>>
>> _______________________________________________
>> 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
>>
>>
>

-- 


*This message and any attachments are subject to a disclaimer published at 
http://www.hisp.org/policies.html#comms_disclaimer 
<http://www.hisp.org/policies.html#comms_disclaimer>.  Please read the 
disclaimer before opening any attachment or taking any other action in 
terms of this electronic transmission.  If you cannot access the 
disclaimer, kindly send an email to disclaimer@xxxxxxxx 
<disclaimer@xxxxxxxx> and a copy will be provided to you. By replying to 
this e-mail or opening any attachment you agree to be bound by the 
provisions of the disclaimer.*

References