Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-13608

Api3 'getoptions' ordering doesn't work as JSON

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.3.0, 4.4.0
    • Fix Version/s: 4.4.0
    • Component/s: None
    • Labels:
      None

      Description

      Some discussion here: http://forum.civicrm.org/index.php/topic,30298
      OK, so the problem is that it is literally impossible to preserve order in a JSON object.
      http://stackoverflow.com/questions/10034655/how-to-maintain-order-when-parsing-json-from-javascript
      Other api actions accept a "sequential" param which will return a javascript array rather than an object, which will preserve ordering. So I think the solution is to support this param for getoptions.
      Return signature:
      [

      {key: 1, value: 'Female'}

      ,

      {key: 2, value: 'Male'}

      ,

      {key: 3, value: 'Transgender'}

      ]

        Attachments

          Activity

            People

            • Assignee:
              colemanw Coleman Watts
              Reporter:
              colemanw Coleman Watts
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours
                2h