Is there a way to add a row in between rows?
Solved! Go to Solution.
Views
Replies
Total Likes
Hello Vic,
yes there is.
Place a button within your table and add the following Javascript code to its click event:
var currentRepeatable = this.parent;
var im = currentRepeatable.instanceManager;
var newRepeatable = im.addInstance(1);
im.moveInstance(newRepeatable.index, this.parent.index);
You might have to replace "this.parent" in line 1 with another SOM-Expression referring to your repeatable row containing your button.
Currently the new instance is inserted in front of the row containing the button. If you want to insert after the current row change the last line to:
im.moveInstance(newRepeatable.index, this.parent.index + 1);
Hope that helps,
Martin
Views
Replies
Total Likes
Do you still need help with this question? If so, I'm assuming you have created a table and an add button to add a new row of cells and that your problem is the row is added at the bottom of the table.
I know how to get this done but it is only something I would describe on video. Let me know if you still need help and I will upload a quick video to youtube or my website. My way of doing it is a bit annoying but it gets the job done (and its the only way I could figure out how to do it).
Andrew
Views
Replies
Total Likes
Yes, please! I still need help!
Thanks!
Views
Replies
Total Likes
One question.
Views
Replies
Total Likes
I have a dynamic table and want to insert in between to rows.
Views
Replies
Total Likes
You can use a button? When not when the rows should be insert?
Views
Replies
Total Likes
yes, you can use a button and can be inserted anytime.
Views
Replies
Total Likes
So watch this 15 sec video on YouTube. I believe this is what you are looking to accomplish. I just want to be clear before wasting time (both of ours). If it is then I will do a full video on how to accomplish it. You likely have set everything up in a table. The only way I could figure out how to make it work this way is to take everything out of the table. You'll see what I mean.
Let me know and I will try to do something this weekend
Views
Replies
Total Likes
Yes! Yes! That's what I'm looking for!
Thanks.
Views
Replies
Total Likes
Hello Vic,
yes there is.
Place a button within your table and add the following Javascript code to its click event:
var currentRepeatable = this.parent;
var im = currentRepeatable.instanceManager;
var newRepeatable = im.addInstance(1);
im.moveInstance(newRepeatable.index, this.parent.index);
You might have to replace "this.parent" in line 1 with another SOM-Expression referring to your repeatable row containing your button.
Currently the new instance is inserted in front of the row containing the button. If you want to insert after the current row change the last line to:
im.moveInstance(newRepeatable.index, this.parent.index + 1);
Hope that helps,
Martin
Views
Replies
Total Likes
Martin,
This worked great! This is what I needed! Thanks for the help!
Views
Replies
Total Likes
I tried pasting on the code as mentioned above but my rows are still inserting from the bottom. Can you please help?
Views
Replies
Total Likes
var currentRepeatable = this.parent;
var im = currentRepeatable.instanceManager;
var newRepeatable = im.addInstance(1);
im.moveInstance(newRepeatable.index, this.parent.index);
xfa.form.recalculate(true);
Views
Replies
Total Likes
Vic,
Thanks, I pasted the code into my "add" button, however the rows are still inserting from the bottom.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies