Expand my Community achievements bar.

SOLVED

Is it possible to have a button that will insert a table row rather than add it to the end?

Avatar

Former Community Member

I have an add row button that works correctly using addinstance, but I would like to have the add row button at the end of each row so a user could insert a row into the middle of existing/fiilled out rows.  Is this possible?  I would like to be able to do this using Formcalc as that is what all of my scripting in the form currently is.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Yes, it is possible, but in effect what the script does is add a new row at the end of the table AND then move the row up to the approrpiate position.

See the examples here: http://assure.ly/gk8Q7a. Table 5 is a Table object, whereas Table 6 is built using subforms. In both cases the Index number is a button, that adds a row below the existing one clicked.

See does that help,

Niall 

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

Hi,

Yes, it is possible, but in effect what the script does is add a new row at the end of the table AND then move the row up to the approrpiate position.

See the examples here: http://assure.ly/gk8Q7a. Table 5 is a Table object, whereas Table 6 is built using subforms. In both cases the Index number is a button, that adds a row below the existing one clicked.

See does that help,

Niall 

Avatar

Former Community Member

As always you are Awesome Niall!

I actually did figure it out right before the response, I found the

insertinstance option in formcalc to use rather than addinstance.

Thank You

Avatar

Level 10

I've always wondered about doing it this way - why add it and then move it when you could just use _rowName.insertInstance(this.parent.index + 1)?

Avatar

Level 10

Hi Jono,

Yes, you are right, insertInstance works and is much cleaner script. I suspose it's just the way I've done it before. I could say "that there's more than one way to skin a cat", but I would have the RSPCA after me. Oops, I just did ;-)

Niall