Problem with custom renderer for picklist

  • 1
  • Problem
  • Updated 2 years ago
Greetings all,

I've been trying to get a custom renderer snippet for a picklist working, but I just haven't been able to find anything here on the community that would help. The picklist that I'm trying to render is a custom field that is not dependent on any other picklists, or record types. The problem that I'm having is that even though my console log shows that the picklist values are being set to what I want, the normal picklist values are still being rendered. Here is the snippet:
var field = arguments[0], 
    value = skuid.utils.decodeHTML(arguments[1]),
	$ = skuid.$;
var otherEntry;

var picklistEntriesNew = [];
field.metadata.picklistEntries.forEach(function(entry) {
    if(entry.value === 'Bad Data') entry.label = 'Bad Data (Delete)';
    if(entry.value === 'Other') otherEntry = entry;
    if((entry.value != 'Intake Queue Errors') && (entry.value != 'Other')){
        picklistEntriesNew.push(entry);
    }
});

// Users want the picklist entries to be in alphabetical order, so we sort them 
picklistEntriesNew.sort(function(entryOne, entryTwo){
  var entryValueOne = entryOne.value.toLowerCase();
  var entryValueTwo = entryTwo.value.toLowerCase(); 
  return ((entryValueOne < entryValueTwo) ? -1 : ((entryValueOne > entryValueTwo) ? 1 : 0));
});

picklistEntriesNew.push(otherEntry);

field.metadata.picklistEntries = picklistEntriesNew;

skuid.ui.fieldRenderers[field.metadata.displaytype][field.mode](field,value);
We have another snippet similar to this one (that one just removes one of the picklist values before rendering) that works as expected. And the field for the above snippet is set up the same way as the snippet that we know that works.

Any clue as to what the problem could be?

Many thanks in advance!
Photo of John Freese

John Freese

  • 542 Points 500 badge 2x thumb

Posted 2 years ago

  • 1

Be the first to post a reply!