Expand my Community achievements bar.

adding and deleting the row in table

Avatar

Former Community Member

Hello all,

In the picture, Row 2 is the sub row of the Row 1.

The two buttons at the top which can add the particular row in the table.

I can add the row 1 by this script -->   this.resolveNode('Table1._Row1').addInstance(1);

1) But i have no idea to success on "+Row2" button?

2) and how to delete the specific row when clicking on the "-" button?

If anyone know something, please tell me.

Thanks a lot.

pic4.jpg

6 Replies

Avatar

Level 10

I don't know if it's possible to mix rows in a table like you have there, at least not easily...it might be possible with some fancy scripting. You can replicate what you are trying to do by building your table out of repeating subforms and then you'll have control over what goes where.

To delete the row that the button is in you can use:

_RowName.removeInstance(this.parent.index);

Avatar

Former Community Member

Thanks jeanette,

The link is awesome and very helpful.

Avatar

Former Community Member

Dear Jono Moore,

Thanks for your reply.

You said to delete the row that the script in the button is as follow:

_RowName.removeInstance(this.parent.index);

fox example, if my row name is called "Row1", then script in the button is like follow:

_Row1.removeInstance(this.parent.index);

but it is not work, am i missing something else?

and "this.parent.index" means???

Thanks.

Avatar

Level 10

this.parent.index is trying to find the index of the row or subform the object is in so you can delete that particular row or subform.

If the object is more than one level below the row (it may be in another subform or more) you'll need to add more parents. So if your delete button is in a subform that is in a table row then you would need to use this.parent.parent.index.

If you look through the tutorials on the Assure Dynamics site Niall has some great examples of how this all works.

Avatar

Former Community Member

Dear Jono Moore,

Appriciate to your reply and explain.

Thank a lot.