Show fields in reference popup built with custom renderer

Matt SonesMatt Sones 💎💎💎
edited April 1, 2020 in Questions
I have a custom field renderer on a reference field like this:
field.options.template = '{{Patient_Case__r.Patient__r.Name}} exam on {{Timeless_Date__c}}';
skuid.ui.fieldRenderers[field.metadata.displaytype][field.mode](field,value);
My search popup has only the Id field.

If I add searchFields to the renderer, like so:
field.options.searchFields = [          {id: 'Id'},
        {id: 'Timeless_Date__c'},
        {id: 'Patient_Case__r.Patient__r.Name'}
    ];
Nothing changes.

If I add returnFields like so:
    field.options.returnFields = [
        {id: 'Id'},
        {id: 'Timeless_Date__c'},
        {id: 'Patient_Case__r.Patient__r.Name'}
    ];
Then my search popup doesn't show any fields at all.

Help?

Comments

  • Emily DavisEmily Davis ✭✭✭✭
    edited March 2, 2017
    Hey Matt,
    For your reference fields, I think you need an additional property showInSearchDialog. Set this to true for each field you want to show in the search popup. So your reference fields code would change to something like:
    field.options.returnFields = [
            {id: 'Id', showInSearchDialog: false},
            {id: 'Timeless_Date__c', showInSearchDialog: true}, {id: 'Patient_Case__r.Patient__r.Name', showInSearchDialog: true}
        ];
    When you say "nothing changes" with the search fields, do you mean things are working as expected, or no? You MIGHT have to specify an additional property for those as well: searchOperator. So this would change your search fields to:
    field.options.searchFields = [
            {id: 'Id', searchOperator: 'contains'},
            {id: 'Timeless_Date__c', searchOperator: 'contains'},
            {id: 'Patient_Case__r.Patient__r.Name', searchOperator: 'contains'}
        ];
    Let me know if that helps.
    Emily
  • Matt SonesMatt Sones 💎💎💎
    edited February 10, 2017
    The 'showInSearchDialog' parameter did the trick. Thanks!

    Now let's document that somewhere, shall we? ;)
  • Emily DavisEmily Davis ✭✭✭✭
    edited March 2, 2017
    Matt,
    Agreed! I'll mention it to our docs team. The way I figured out the extra properties was by adding some search fields in the builder and running a custom renderer on the field that simply console.log's the field to see the options. Not as ideal as documentation, though...
    Emily
  • Matt SonesMatt Sones 💎💎💎
    edited February 10, 2017
    nice trick! thanks.
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!