reference fields not link

  • 1
  • Question
  • Updated 4 years ago
  • Answered
I would like to use reference fields in a table that require the user lookup the associated they need and also NOT automatically link in read mode.

Is there a way to do this without javascript? If not, what do I need to do in javascript?
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,674 Points 20k badge 2x thumb

Posted 4 years ago

  • 1
Photo of JD Bell

JD Bell, Senior Product Engineer

  • 2,996 Points 2k badge 2x thumb
Hey Pat,

Sounds like you want a standard reference field when in edit mode, but you don't want a hyperlink when in read mode.

That's possible using a custom field renderer. We've written some documentation on how to build a custom field renderer for a table: http://help.skuidify.com/m/11720/l/204496-table-component-custom-field-renderers

A reusable field renderer like you are describing could look something like this:

var field = arguments[0],
value = arguments[1],
template = '{{{' + ( field.id.substr( 0, field.id.length - 3 ) ) + '__r.Name}}}';
    
if ( field.mode == 'edit' )
    skuid.ui.fieldRenderers[field.metadata.displaytype].edit( field, value );
else
    field.element.append( skuid.utils.merge( 'ROW', template, {}, field.model, field.row ) );
(Edited)