Quantcast
Channel: Adobe Community : All Content - LiveCycle Designer
Viewing all articles
Browse latest Browse all 5571

How to insert table rows dynamically?

$
0
0

I have a table with 18 rows. Each of the first 17 rows have read-only text (mandatory activities) in a text field in the first column; the last row is a blank row with an add button so the user can add a new activity to the bottom of the table.

 

I've been asked to allow users to insert a new activity at any location in the table (for example, to insert a new Row 7 after Row 6), instead of just at the end of the table. (Obviously this also requires removing the text from the activity text box and changing it to User Entered, as well as a couple other housekeeping activities, which shouldn't be a problem if I can just get the darn row to insert!)

 

I've searched the forums and reviewed some of Assure Dynamics excellent examples. From what I've seen, this should be relatively straightforward...but it's not working.

 

Or rather, it works fine in the first row, multiple times even. I've got a message box displaying the current and new row indices correctly for every row. But in any other row than the first, insertInstance() gives me an "index value is out of bounds" error even when the message box shows the correct indices.

 

Given the following structure and code in each row's ActivityAdd button, can anybody tell me what I"m doing wrong? Thanks!!!

 

-------------------------------------------

tableStructure.png

---------------------------------------------

 

T_Activities.R_Activity[0].T_AddRemove.R_Add.B_ActivityAdd::click - (JavaScript, client)

 

var vNewRowIndex = this.parent.parent.parent.index + 1;

 

xfa.host.messageBox("This row index: " + this.parent.parent.parent.index + ". New row index: " + vNewRowIndex + ".");

T_Activities.R_Activity.instanceManager.insertInstance(vNewRowIndex, 1);

 

------------------------------------------------

 

FWIW, I've seen the cautions regarding the instance manager and underscores in object names...for better or worse, *all* of my object names in *all* of my forms use underscores like this, and to the best of my knowledge I've never had a problem. If that turns out to be the problem here, I'll gladly change the names in the table.


Viewing all articles
Browse latest Browse all 5571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>