Hello,
I've recently being making a dynamic flowable table with an "add a row" button. I've also added a reset button to the form and it clears out all the text well, but I was wondering if there was any way for it to reset the rows in the table to 1. I saw another post that indicated a reset button couldn't do that, but I wasn't not completely clear about that in the post. Input would be appreciated. Thanks!
Solved! Go to Solution.
Views
Replies
Total Likes
Looks like you are operating on the wrong table. Try...
// form1.#subform[0].Subform1.Button2::click - (JavaScript, client)
xfa.host.resetData();
var cnt = Subform2.Table.Table1._Row1.count;
for (var i=cnt; i > 1; i--) {
Subform2.Table.Table1._Row1.removeInstance(i-1);
}
rather than...
// form1.#subform[0].Subform1.Button2::click - (JavaScript, client)
xfa.host.resetData();
var cnt = Subform1._detail.count;
for (var i=cnt; i > 1; i--) {
Subform1._detail.removeInstance(i-1);
}
Steve
Views
Replies
Total Likes
The attached contains a dynamic sub-form in which you can add and delete rows. I added a button called 'resetBtn' and add the following script on the click event. It gets the count of row instances, iterates over the sub-form removing row 2..n and then does a resetData() to clear row 1.
// form1.page1.detailHeader.resetBtn::click - (JavaScript, client)
var cnt = form1.page1._detail.count;
for (var i=cnt; i > 1; i--) {
form1.page1._detail.removeInstance(i-1);
}
xfa.host.resetData();
Steve
Views
Replies
Total Likes
I tried using the script you suggested in the post and the file and it did nothing. Any other suggestions? Thanks!
Views
Replies
Total Likes
I'm still hoping to find a way to reset the number of rows in the table on my form when I hit the reset button. I tried the scripting suggested, but it just isn't working. I'm including a link to the form if some could give me a clue of what I need to do, I'd appreciate it. https://acrobat.com/#d=yQV38javGYBkrNdlvcQbKw
Thanks!
Views
Replies
Total Likes
Looks like you are operating on the wrong table. Try...
// form1.#subform[0].Subform1.Button2::click - (JavaScript, client)
xfa.host.resetData();
var cnt = Subform2.Table.Table1._Row1.count;
for (var i=cnt; i > 1; i--) {
Subform2.Table.Table1._Row1.removeInstance(i-1);
}
rather than...
// form1.#subform[0].Subform1.Button2::click - (JavaScript, client)
xfa.host.resetData();
var cnt = Subform1._detail.count;
for (var i=cnt; i > 1; i--) {
Subform1._detail.removeInstance(i-1);
}
Steve
Views
Replies
Total Likes
Thank you so much. I knew what I had originally been given wasn't correct and I was playing around with the script but I knew I wasn't right.
Views
Replies
Total Likes