Duplicate Data Table Row

I feeling I have seen the answer to this before but cannot find it again. I need a (preferably elegant) solution to duplicate a data table row.

My current thoughts are to create a new row by dict using info from this post

app_tables.table.add_row(**dict(list(original_row)))

Is there a better way to do this?

or just **dict(original_row) if it’s server-side…

(edit or client side too now)

2 Likes

Hi, would **dict(original_row) work if the original_row has a field of multiple links? Just checking…

Using this method, you are unpacking a dictionary created from a row, (which is already a dict-like object) so, nothing about any of the objects contained in the row are touched.

If it came from a data table, one would assume it could go back into the same data table.

If you are inserting new data, ymmv.

If you are just asking about the ** operator, check out this link:
Passing Multiple Arguments to a Function