How to select rows from a model then display only the selected rows on another tab in a wizard without saving first

  • 1
  • Question
  • Updated 10 months ago
  • Answered
I'm building a billing application where a user selects from a list of items to add to an invoice.  I associate the items with the invoice by updating a field on the item record that links it to the invoice.  I am aggregating totals like price and quantity and updating the invoice with those values.  I'm doing this all in a wizard where step 1 is create the invoice with the date range, step 2 is select the items, step 3 is confirm and save the invoice.

All of this is working great.  

Right now, step 3 just shows the invoice header and the calculated totals without displaying the items associated with the invoice.  All of the selected records are associated with the invoice, but nothing has been saved into the database at this point, nor do I want it to be.  I want to save everything on the confirmation step.  

My challenge is that I'd like to display only the selected items in a table under the invoice header on the step 3 tab.  I'm sure I could copy all the selected records into a UI only model, but it seems like I should be able to filter a model that points to the same data source with a condition that reads the records that have changed but haven't been saved.  I created a new model with filter conditions, but querying the model goes back to the DB and applying the condition doesn't seem to work without requerying.  Can someone tell me if I'm missing something obvious?

Thanks!
Photo of Steve Wasula

Steve Wasula

  • 220 Points 100 badge 2x thumb

Posted 10 months ago

  • 1
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Consider setting up a twin model and using the “adopt rows into model” action as a mass action. You should be able to select the rows you what, then use the mass action to adopt the selected rows into the twin model and display that twin model in a table. You can modify and save the two models independently even though they are displaying the same rows from the same object.
Photo of Steve Wasula

Steve Wasula

  • 220 Points 100 badge 2x thumb
Thanks Skuidward!  That's exactly what I needed and worked like a charm!