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).
Yes, please! I still need help!
- You have an static table?
- Or you have a dynamic table and want to insert a row when you click a button but you want not to insert upstream. You want to insert above?
I have a dynamic table and want to insert in between to rows.
You can use a button? When not when the rows should be insert?
yes, you can use a button and can be inserted anytime.
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
Yes! Yes! That's what I'm looking for!
yes there is.
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,
This worked great! This is what I needed! Thanks for the help!
I tried pasting on the code as mentioned above but my rows are still inserting from the bottom. Can you please help?
var currentRepeatable = this.parent;
var im = currentRepeatable.instanceManager;
var newRepeatable = im.addInstance(1);
Thanks, I pasted the code into my "add" button, however the rows are still inserting from the bottom.