AFG-Polio-Data / APMIS-Project

APMIS (Afghanistan Polio Management Information System) is an supplemental Immunization Activities management system to manage the vaccination activities in the country.
https://test.afghanistan-apmis.com
GNU General Public License v3.0
4 stars 8 forks source link

Form dropdown list should be sorted based on order in JSON form #495

Closed RaziaMahmodi closed 12 months ago

RaziaMahmodi commented 1 year ago

Forms dropdown list order should be based on the order in JSON forms.

Example 1: Image

Image

Example 2: Image

Image

sundayAdu commented 1 year ago

This is logically not possible since our data is filled from JSON which is fluid. However, the administrator can solve this problem by making use of sortable keys as they would like the data to be shown to the user e.g numeric values can be added in front of the the keys (1..., 2...)

bnygren commented 1 year ago

Thanks @sundayAdu . Let's discuss on a Thursday meeting

RaziaMahmodi commented 1 year ago

As per discussion, the better solution can be adding another key as key order to be able to sort the items based of on.

DevSeg commented 1 year ago

In order to achieve this, simply add the "order" attribute to the JSON construction as shown in the sample below { "type": "dropdown", "id": "LotClusterNo", "caption": "Lot Cluster Number", "important": "true", "options": [ {"key":"2","caption":"Sungba","order":"1"}, {"key":"1","caption":"Zebra","order":"5"}, {"key":"3","caption":"Monkey","order":"2"}, {"key":"6","caption":"Frogs","order":"3"}, {"key":"5","caption":"Toads","order":"4"}, {"key":"4","caption":"Lions","order":"0"} ]
}

bnygren commented 1 year ago

@DevSeg great, thanks!