I follow the example here, and use it to make a dynamic table. The +/- button now work as my Add/Delete row button.
Learnt from the guide, I can use instance manager and add or remove instance of row. Now I want to know which row I'm editing now, so that when there is data in the rows other than the first row, it pops up an alert to remind me to fill in the first row as a preliminary.
Code of instance manager that works in my local:
var oTargetSubform = addButton.parent.repeatingTable.repeatingRow; // The subform or table row the controls are intended to manipulate.
var oManager = oTargetSubform.instanceManager; // Get the instance manager.
while I guess the property I should refer to is oManager.index, it always return 0, yet I don't find the definition of "index" in Designer 11 document: Adobe LiveCycle ES4 * instanceManager
to be able to know which row you are currently within when editing a field, in any event you can call the index property from the field's parent row... In occurence, you will have to use the parent property to access the row which the field is inside of...
E.g.: this.parent.index -> (1) parent means the field is directly in the row considered as a cell
this.parent.parent.index -> (2) parents means the field is within a subform in the row