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

  • 43,056 Points 20k badge 2x thumb

Posted 4 years ago

  • 1
Photo of JD Bell

JD Bell, Senior Product Engineer

  • 3,068 Points 3k 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:

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

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