Picklist entries custom renderer not working

Matt SonesMatt Sones 💎💎💎
edited March 3, 2019 in Questions
Does anyone see anything wrong with this?
Renderer isn't working. No console errors other than 'Refused to set unsafe header agent'

Seems like somehow the field metadata isn't getting overwritten? I'm just getting the standard values for the picklist. I've watched the rendering in the console, and the picklistEntries array is definitely getting populated with the right values.
'renderPRLLists': function(field,value){ value = skuid.utils.decodeHTML(value);
var listModel = skuid.$M('CreatePRL_Lists'),
picklistEntries = [];
$.each(listModel.getRows(),function(i,row) {
picklistEntries.push(
       { value: row.Name, label: row.Name, defaultValue: false, active: true }
);
});  
field.metadata.picklistEntries = picklistEntries;
skuid.ui.fieldRenderers.MULTIPICKLIST.edit(field,value);
field.model.updateRow(field.row, field.id, value, {initiatorId: field._GUID});
}

Comments

  • Barry SchnellBarry Schnell 💎💎
    edited February 25, 2017
    Hey Matt -

    A few things:

    1) I'm assuming you've done this, but have you debugged to make sure that the renderer is getting called and inspected the metadata.picklistEntries before/after establishing the new value?

    2) Is there a reason you are calling updateRow in the last line?  The value of the field should already be set by the time the renderer is called so I'm not seeing a reason that you need to update the field value?

    3) What version of Skuid are you running?

    4) Can you try changing the code to use a hardcoded list of values instead of from a model just to rule out a 'data' issue with the model data itself?  For example:
    var picklistEntries = []; picklistEntries.push({ value: '0', label: 'AAA', defaultValue: false, active: true });
    picklistEntries.push({ value: '1', label: 'BBB', defaultValue: false, active: true });
    picklistEntries.push({ value: '2', label: 'CCC', defaultValue: false, active: true });
    field.metadata.picklistEntries = picklistEntries;
  • Matt SonesMatt Sones 💎💎💎
    edited February 25, 2017
    Good ideas, Barry.
    1) Yes.
    2) No idea what I was thinking there.
    3). 8.10
    4)  I'll do some more digging.
  • Barry SchnellBarry Schnell 💎💎
    edited November 18, 2016
    Sounds good Matt, just lemme know.  Btw, I threw together a quick sample with 8.10 and it's working as expected for me so there is hope :)
  • Matt SonesMatt Sones 💎💎💎
    edited February 10, 2017
    The crazy thing is, it's running just fine in our dev org. But it's not working in production. Any thoughts on what the difference might be? The only difference in the code is that I ran it through uglify.
  • Barry SchnellBarry Schnell 💎💎
    edited February 25, 2017
    That is rather strange.  Couple of questions/thoughts:

    1) 8.10 in both Dev & Prod?
    2) Dev is Summer '16 or Spring '16?  If Dev is Summer '16, do you you have a Spring '16 SBX that you can test against? 
    3) For some reason, I remember seeing a thread a while back where Zach mentioned something about overriding picklist values and it not respecting the change and there was a reason.  Unfortunately, I can't remember the reason nor can I find the thread right now.  I might be remembering incorrectly but for some reason, that memory is sticking out in my head right now. 

    Zach - Any thoughts?  Maybe I'm not remembering correctly?
  • edited March 1, 2017
    Are there record types or picklist dependencies that are different in the two orgs? Skuid applies extra logic for picklists that have record type dependencies and may be throwing out your changes. I can't dive into the code on this right now, but it might be worth checking.
  • Matt SonesMatt Sones 💎💎💎
    edited February 10, 2017
    Ah, that's right. Thanks, Ben & Barry. I think we have some legacy record types in production that I need to remove. They're probably at fault.
  • Barry SchnellBarry Schnell 💎💎
    edited November 18, 2016
    Thanks Ben, that's what I remember seeing!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!