Note sure if this is what you were after.
I created a simple table with two rows, one row has 4 cols, has a button to show the second row and is visible. The second row has the cells merged and is hidden.
I have a button to create 'new rows' positioned outside the table. The trick is to wrap the table in a subform and repeat the subform (sfTable), NOT the table (Table1). So instead of creating new rows, you are actually creating whole new tables wrapped in a subform. The page also needs to be flowed.
form1.#subform[0].sfTable.Table1.Row1.btnShowRow::click - (JavaScript, client)
this.resolveNode("RowMerged").presence = "visible";
form1.#subform[0].btnNewRow::click - (JavaScript, client)
this.resolveNode('form1.#subform._sfTable').addInstance(1);
if (xfa.host.version < 8) {
xfa.form.recalculate(1);
}
What this does is this:-
You can keep adding new rows (subforms) and in each instance you can show (unhide) the single merged row if you wish. Note: I havent added a hide button.