is there a way to sort the options that we add to a list with g_form.addOption()?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2014 03:11 AM
is there a way to sort the options that we add to a list with g_form.addOption()?
- Labels:
-
Service Mapping

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2014 01:43 AM
Hi Vikrant,
you have to define dat particular field and itz value to remove the option..so i hope oly that field and choice value will be removed.
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2014 01:46 AM
How do I sort the options though even after removing it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2014 01:45 AM
Hi Vikrant,
Not sure if you have tried this, but is it not possible to take all the values in an array, sort them first and then use addOption to add it in sequence.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2014 01:47 AM
I though about it but I am using a glide record and not sure how to get the value for the glide record in an array?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2014 01:52 AM
Hi Vikrant,
That shouldnt be a problem, you can declare an array, use the while loop of the glide record and store the values in array. Using a simple example below, replace with your respective field names and gr for gliderecord object.
var arr = [];
var i = 0;
while(gr.next()){
arr[i] = gr.value;
i++;
}
you can use arr.sort(); statement to sort in alphabetical order if this solves your problem.