Is there a way to get at the none label in a picklist created by a custom field renderer? I have an integer field that is conditionally rendered as a Yes/No picklist. We’ve been using a separate field Not_Applicable__c but I’d rather just use the blank value of my Value__c field and relabel to say “n/a”
I’ve tried field.options.nonelabel=“n/a” and field.options.addnoneoption=“true” which mimics what shows up for a normal field in the XML when you make it required and add a none option, but they don’t have an effect. They either don’t add a none option to my radio buttons, or if I make the field not required, the default null option shows “-none-”
Here’s the snippet I am using
var field = arguments 0],
row = field.row,
value = skuid.utils.decodeHTML(argumentsd1]),
metadata = field.metadata,
element = field.item.element,
$ = skuid.$;
isNA = (row.Not_Applicable__c);
isYes = (row.Type__c == 'Yes') ? true : false;
isNo = (row.Type__c == 'No') ? true : false;
response = row.Value__c;
console.log(response);
if (!isNA){
field.item.element.removeClass("gray-row");
field.item.element.removeClass("nodisplay");
if (isYes){
//create a blank variable for picklist entries
var picklistEntries = ;
// set the picklist entries. note defaultValue doesn’t matter, the first one will be default
picklistEntries.push(
{ value: ‘0’, label: ‘Yes’, defaultValue: false, active: true },
{ value: ‘1’, label: ‘No’, defaultValue: false, active: true }
);
field.metadata.picklistEntries = picklistEntries;
field.options.type = 'RADIO_BUTTONS';
// render the field as a picklist
skuid.ui.fieldRenderers.PICKLIST.edit(field,value);
}
if (isNo){
//create a blank variable for picklist entries
var picklistEntries = ;
// set the picklist entries. note defaultValue doesn’t matter, the first one will be default
picklistEntries.push(
{ value: ‘0’, label: ‘No’, defaultValue: false, active: true },
{ value: ‘1’, label: ‘Yes’, defaultValue: false, active: true }
);
field.metadata.picklistEntries = picklistEntries;
field.options.type = 'RADIO_BUTTONS';
// render the field as a picklist
skuid.ui.fieldRenderers.PICKLIST.edit(field,value);
field.item.element.removeClass(“gray-row”);
}
if (!isNo && !isYes){
//use the default renderer
skuid.ui.fieldRenderersefield.metadata.displaytype]field.mode;
}
}
if (isNA){
field.item.element.addClass(“gray-row”);
field.item.element.addClass(“nodisplay”);
}