Custom reference field renderer

  • 1
  • Question
  • Updated 2 years ago
  • In Progress
I'm looking to custom render a lookup field so that I can add an option before all choices if there is no match. Using input.autocomplete({source:.., select:...}) and source function seems to work partially. Can you provide a simple example to show like an array of static values in the custom renderer for a lookup field? Simple value and label pair do not seem to display the dropdown values properly. Thanks!
Photo of jili@heidrick.com

jili@heidrick.com

  • 2,032 Points 2k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Janick

Janick

  • 916 Points 500 badge 2x thumb
Hi Jili,

Have you already tried the steps in this documentation: https://docs.skuid.com/latest/en/skuid/api/skuid_ui.html#skuid-ui-field-renderers  ?
Search for function : PICKLIST() , this should be the part you need for this. 

I hope this helps,

Janick
Photo of Pete O'Connell

Pete O'Connell

  • 214 Points 100 badge 2x thumb
You can add all of the values to the source like this:
{
    label: "<something you want>",
    value: "<Id for something you want>"
}

You can also add custom fields on here if you need more information:
{
    label: "The human readable version",
    value: "12346",
    parentId: "12345",
    favoriteColor: "literally anything",
    sourceObj: {
        name: "The human readable version"
        id: "12346",
        parentid: "12345",
        fav_color: "literally anything"
    }
}
Photo of jili@heidrick.com

jili@heidrick.com

  • 2,032 Points 2k badge 2x thumb
I was hopeful for a sec. Label/value pair does not work for lookup field though. Thanks.
Photo of Pete O'Connell

Pete O'Connell

  • 214 Points 100 badge 2x thumb
You can extend the select function for autocomplete to assign the ID