Skip to Main Content
Set an Attribute to read only or hidden Split email into First Last or Last, First

Shuttle Sorting

APEX JavaScript
How to sort values in a shuttle

Function and Global Variable Declaration

function sortSelectOptions(pThis){
 var t=$($x(pThis));
 var o=t.children("option");
 o.detach();
 o.sort(function(a,b){
  a=a.firstChild.nodeValue; 
  b=b.firstChild.nodeValue;
  if(a==b){
   return 0;
  } 
  return (a>b)?1:-1; 
 });
 t.append(o);
}

Dynamic Action

Event / Change / ItemPNNNN_SHUTTLE
Event Scope

 

Execute JavaScript Code* See below
Fire On InitializationYes


 

Code

sortSelectOptions('PNNN_SHUTTLE' + '_LEFT');
sortSelectOptions('PNNN_SHUTTLE' + '_RIGHT');