How to create a 'soft duplicate' in Jmix tables

I have an object that contains a set of UnitPrices…

I have an existing table that displays all the objects, but I want to also display the same object multiple times, depending on how many unit prices there are.

So if there are 4 unit prices, then I want 4 rows to be printed, containing completely identical information, except for the different unit price data.

Is this possible, by adding to the getMutableItems() list?

(I also don’t want to copy objects using the metatools copy functionality, where new primary keys will be created and saved etc. Ideally the main object ids will remain the same, but just with duplicate rows)

1 Like

Hi,
Look at this https://demo.jmix.io/ui-samples/sample/copy-action
Personal I used copy and edit genedatabank/src/main/java/com/genebank/genedatabank/view/pasaport/PasaportListView.java at master · florintanasa/genedatabank · GitHub

LE. If I understood correctly?

Hi Florin,

Thanks, but its not quite what I’m looking for. I’m looking for a way to create a copy, but not save the copy. In your example, ‘copy’ creates a new copy and saves it to the database, and ‘copy and edit’ also saves to the database after closing.

I just want to create a new row in the UI based off an already saved entity instance.

How about having a DTO, and filling it with needed data, would that help? Nothing would be saved, only displayed.

@jamie.guthrie according to me to create a ‘soft duplicate’ in Jmix tables you can follow this step
Create a wrapper class
Generate virtual rows
Display the wrapper