Instance manager and subforms

Avatar

Avatar

Michael_E_Murph

Avatar

Michael_E_Murph

Michael_E_Murph

08-12-2008

I'm using a JS statement that I've found to dynamically delete subform rows when the user clicks a delete button:



Subform.Row1.instanceManager.removeInstance(this.parent.index);



This works if my delete button appears in Row1, like this:



Subform

Row1

Button

Field1

Field2



However, I'd like to wrap the button in a subform so that I can hide the button on print. My table looks like this:



Subform

Row1

SubformA

Button

SubformB

Field1

Field2



Row1 is a flowed subform so that when I hide SubformA I don't get any empty space.



The JS statement isn't working. With my ignorant eyes it appears that instead of this.parent.index I need something like this.grandparent.index. Is something like this do-able? Any alternative ideas?

Replies

Avatar

Avatar

pguerett

Avatar

pguerett

pguerett

09-12-2008

Instead of wrapping the delete button why not change its presence to visible screen only. You can see that property in the Object palette.

Avatar

Avatar

Ryan_Lunka

Avatar

Ryan_Lunka

Ryan_Lunka

09-12-2008

Also, instead of this.grandparent.index, try this.parent.parent.index. That should work.

Avatar

Avatar

Michael_E_Murph

Avatar

Michael_E_Murph

Michael_E_Murph

15-12-2008

Thank you rlunka! That did the trick. And thank you for your quick reply Paul. I didn't tell you that I was trying to get fancy by using a hidden button object and a graphic. To get the graphic positioned on top of the button, I placed them within a positioned subform.



So my table really looks like this:



tTravelers

Row1

sTravelers (flowed subform)

untitled subform (positioned subform)

removeButton

image

untitled subform

Field1

Field2

FooterRow

untitled subform

addButton

image



The click event on the removeButton object looks like this:

tTravelers.Row1.instanceManager.removeInstance(this.parent.parent.parent.index);



sTravelers is a flowed subform, so when I hide the removeButton untitled subform (which takes up the entire row width), I don't get any blank space. Sorry if this is too much info. Now I just need to test the heck out of it.