Anyone know an easy way to get the ref_contributions to render in a specific order?

DrewW
Mega Sage

Anyone know an easy way to get the ref_contributions to render in a specific order?   I have two on the caller field on our incident form, one just shows when the caller is a VIP and I would like it to render after all others.   tried changing the order of the ref_contributions attribute but that did not help.   Right now I'm looking at a client script to do it but that seams like the ugly way to do it.   Hoping someone knows an easy way...

Here is the code if anyone is interested, I changed it from a client script because in Fuji the icon did not really display well.

<?xml version="1.0" encoding="utf-8" ?>

<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

<j:set var="jvar_n" value="show_vip:${ref}"/>

<a id="${jvar_n}"

      name="${jvar_n}"

      style="visibility: hidden"

>

      <img border="0" src="images/icons/vip.gif" title="${gs.getMessage('VIP')}" alt="${gs.getMessage('VIP')}"/>

</a>

<script>

//

// show icon if caller is VIP, hide if not

//

function onChange_show_vip(control, oldValue, newValue, isLoading) {

      var callerLabel = $('label.incident.caller_id');

      var callerField = $('sys_display.incident.caller_id');

      if (!callerLabel || !callerField)

              return;

     

      if (!newValue) {

              gel('${jvar_n}').style.visibility = "hidden";

              callerField.setStyle({color: ""});

              return;

      }

      g_form.getReference('caller_id', vipCallerCallback);

}

function vipCallerCallback(caller) {

      var callerLabel = $('label.incident.caller_id').down('label');

      var callerField = $('sys_display.incident.caller_id');

      if (!callerLabel || !callerField)

              return;

     

      //check for VIP status

      if (caller.vip == 'true') {

              //Show VIP icon

              gel('${jvar_n}').style.visibility = "visible";

              //Set Field color

              callerField.setStyle({color: "red"});

      } else {

              gel('${jvar_n}').style.visibility = "hidden";

              callerField.setStyle({color: ""});

      }

}

// create a handler

var h = new GlideEventHandler('onChange_incident_show_vip', onChange_show_vip, '${ref}');

g_event_handlers.push(h);

</script>

</j:jelly>

5 REPLIES 5

Have you tried creating separately named functions for each icon.