Add fields to an existing field editor dynamically

  • 1
  • Question
  • Updated 1 year ago
  • Answered
  • (Edited)
I have a tab on which I have a number of field editors positioned in the way that the designer would like. For one of these editors I would like to add fields dynamically via a Javascript snippet.

All the postings I can find thus far refer to the dynamic creation of the entire field editor. I don't want to do that. I want to target a specific field editor and add fields to it.
Photo of Mick Starcevic

Mick Starcevic

  • 80 Points 75 badge 2x thumb

Posted 1 year ago

  • 1
Photo of Mike Dwyer

Mike Dwyer

  • 3,390 Points 3k badge 2x thumb
What you may need to do is include ALL the potentially desired fields in the field editor and render them based on a javascript snippet returning true. Whatever conditions are tested by the javascript will return true for the fields you would "add" when those conditions exist.

You will probably need multiple snippets for each set of fields that share a common condition set, and conceivably one snippet for each conditional field.
Photo of Mick Starcevic

Mick Starcevic

  • 80 Points 75 badge 2x thumb
Hey Mike,

Thanks for your response. 

My problem is that the source table/model is dynamic in that users can add new records at any time. 
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Mick,

I don't think there is any way to do this without creating a custom component (i.e. a field editor that you render dynamically).  Mike's suggestion would also work for what it seems that you are trying to achieve.

When a second record is added to a model and you are displaying the data in a field editor, Skuid will repeat the field editor.  I don't think that is what you want.  Would you give us a little more of your requirement.

Thanks,

Bill