Can you use a tab set to create multiple records for the same Model?

  • 1
  • Question
  • Updated 2 years ago
Looking to be able to create an Outlet (Store) on each tab of a tab set. Then when either clicking save, or navigating to another tab the record will be saved to the Model. 

It looks like as of right now each tab will relate to 1 record in the model, or as I progress through the tabs it will add another block of the fields. (For example, if I have 3 tabs, when I click through tab 2, and then to tab 3, there are 3 blocks of fields. Because I use the action Create new Row)

Is it possible on each tab, to have 1 block of fields that creates a new row, without showing all active rows?
Photo of Richard Amantia II

Richard Amantia II

  • 754 Points 500 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Emily Davis

Emily Davis, Employee

  • 3,502 Points 3k badge 2x thumb
Hi, Richard,
That's an interesting use case. So you're working with multiple records in a single model, but you want to show a single record from the model on each tab?

I think there are couple ways you could tackle this:
  1. Create a model (off of the same object) for each tab. It's a little clunky, but shouldn't be too bad if you have a known number of tabs. The upside to this is it would allow the user to easily jump back and forth between steps.
  2. On each step, run a few actions: (a) Save the model, (b) Empty rows from the model, (c) Create a new row in the model. The downside to this is it really isn't optimal for the user going back a step in the process. If you go with this approach, I would recommend using the Wizard component rather than the Tabset. On each Wizard step, provide a button to go forward to the next step, but not to go back a step.
Does that help? Let me know if you have more questions.
Emily
Photo of Richard Amantia II

Richard Amantia II

  • 754 Points 500 badge 2x thumb
Hi Emily, 

Thanks for the response!

I am currently already using a Wizard on a bigger scale and wanted to potentially avoid, using a wizard inside of a wizard. (I was not sure the implications of this, but if it is a usable alternative let me know)

I have tried to use actions to set this up; between setting conditions when re-querying a model, deleting rows, creating new rows, etc. etc. Unfortunately, I have not been able to successfully make this happen through actions. 

The main purpose behind this was that a user does not have to scroll down to add 3 or 4 records of the same kind, all requiring the same fields and related objects and fields. 

Again I appreciate the response!

Richard
Photo of Emily Davis

Emily Davis, Employee

  • 3,502 Points 3k badge 2x thumb
Richard,
I would go for the approach of using multiple models (1 model for each record they need to submit). Do you think that will work for what you're trying to do?
Emily
Photo of Richard Amantia II

Richard Amantia II

  • 754 Points 500 badge 2x thumb
Emily, 

I will look into whether or not this will work for my use case and post back if anything comes up! Again I appreciate your time and the response!

Thanks, 
Richard
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Hi Richard -

If you know up-front how many Outlets will be needed, I think Emily's approach would be the simplest.  However, I'm guessing the number of Outlets that a user would want to create is unknown in which case, multiple models, at least in a declarative manner, would not suffice.

I would need to understand your scenario & use cases in more detail to be sure, but I believe there is a way you can accomplish what you are after.  In short, it would require javascript as you would need to apply a context to the field editor on each tab and/or dynamically create components on the tab.

One alternative to multiple tabs would be to use a table and a row action that displays a popup (the popup would replace the tab).  This would allow users to create new Outlets and modify their information all from one screen with a single save button at the top.

If multiple tabs are needed and your open to javascript based solution, let me know and we can explore further.