Custom reference field renderer

edited April 2018 in Questions
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!

Comments

  • JanickJanick Member
    edited March 2017
    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

  • edited March 2017
    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"
        }
    }
  • edited March 2017
    I was hopeful for a sec. Label/value pair does not work for lookup field though. Thanks.
  • edited March 2017
    You can extend the select function for autocomplete to assign the ID
Sign In or Register to comment.