I have dynamic table set-up to adds rows via the instance manager.
Each table row has a button to delete that specific instance.
The problem I’m having is that if a row is deleted in the middle of the table, the rows don’t re-number.
For instance, if the table has rows numbered 1, 2, 3 & 4 and row 2 is deleted, I want
the rows to be re-numbered as 1, 2 & 3. Instead, what I end up with is rows 1, 3 & 4.
The script I’m using to number the rows is:
this.rawValue=this.parent.index+1
I’ve read in other posts that this script used in a table will automatically update the
row numbers if a row is deleted.
For some reason it’s not working for me.
Any suggestions.
Thanks!
Solved! Go to Solution.
Views
Replies
Total Likes
I created a sample for you ..have a look and let me know this is what you wanted.
Paul
Views
Replies
Total Likes
I created a sample for you ..have a look and let me know this is what you wanted.
Paul
Views
Replies
Total Likes
Paul,
It worked great!
Just one more question.
Is there a way to re-number rows using a decimal numbering format?
I came up with this script through trial and error. I'm sure it's not the correct way to do this, but it seems to work.
The only problem is that it self destructs when you get to 6.10. In order to deal with this limitation, I have to set the maximum number of instances to 9.
this.rawValue = "7." + this.parent.index - ".9";
I've tried to incorporate this decimal numbering into the script you gave me to re-number the rows, but I can't get it to work.
Thanks for your help.
Kurt
Views
Replies
Total Likes
In the script where you set the number use this expression instead.
6 + ((i + 1)/10);
Paul
Paul,
It works perfectly.....thanks!
There is only one other type of numbering/listing that I use in my forms and that's alphabetical. If you could help me out with re-numbering rows that are listed alphabetically, I'd be forever in your debt.
I'm listing the rows alphabetically (A. B. C. D.) using the below script.
this.Cell2.rawValue = String.fromCharCode(this.parent.index + 65)+".";
I tried putting this script in for the number but it isn't working. All of the subform instances/rows are numbered as "A.".
for (i=0;i<=T3.Detail.instanceManager.count;i++){
xfa.resolveNode("Detail[" + i + "].Number").rawValue = String.fromCharCode(this.parent.index + 65)+".";
Kurt
Views
Replies
Total Likes
In the for loop where you set the Number field you shodul be using the variable i and not the refernce to the subform index (this.parent.index). So it should look like this:
String.fromCharCode(i + 65)+".";
Paul
Paul,
Works great.....thanks for your help!
Kurt
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies