This conversation has been locked due to inactivity. Please create a new post.
This conversation has been locked due to inactivity. Please create a new post.
Hello,
I know this is a simple JavaScript, but how do you reset a table's row count to the initial count after pressing a Reset button? Currently, I have 3 rows as the initial count (as indicated in the Binding tab), but if I go and add 2 addition rows (thereby bringing it to 5), then press the reset button to reset the entire form, all the data clears as expected, but the row count says at 5 instead of defaulting back to the initial row count of 3.
I tried adding xfa.layout.relayout(); to the rest button script to no avail.
I presume need to use a script to trigger the row count (something count == 3)...I just don't know what script to use.
Please advise.
Thanks.
Views
Replies
Total Likes
I think you may need an xfa.form.remerge() instead of the xfa.layout.relayout().
Views
Replies
Total Likes
Hmmm, that didn't work...thank you for your input though; I appreciate it!
I think I may have gotten it to work with:
Body4.JobExp._detail.count = 2;
Body4 = subform name
JobExp = table name
_detail = row
I just added it to the Reset button's click event.
S
Views
Replies
Total Likes
This is the Javascript on my reset button now:
form1.BodyPage.ResetButton1::click - (JavaScript, client)
xfa.host.messageBox("Are you sure you want to erase ALL data on this form and start over?")
xfa.host.resetData();
xfa.form.remerge();
app.runtimeHighlight = false
I use the app. runtimeHighlight line to clear the red border on required items on a form reset.
Trying your solution but it doesn't seem to work for me. Did you get this to work?
Views
Replies
Total Likes
Hi,
What I have done in the past is to loop through the repeating instance until the count is back to what I want. The following is additional script in a reset button:
// loop through table and delete rows
while (Table1._Row1.count > 1)
{
Table1._Row1.removeInstance(0);
}
Row1 in the repeating object and the underscore '_' is shorthand for instanceManager.
Hope that helps,
Niall
Views
Replies
Total Likes
Bingo! That did the trick.
Niall you are awesome!
Views
Replies
Total Likes
I have a follow-up to this. I have the table row reset working, but my issue is that if I say "no" when the reset dialog box comes up, it still resets the rows. How do I add to this to keep this from happening?
Views
Replies
Total Likes
Are you using app.alert to get the yes/no answer?
var nButton = app.alert({
cMsg: "Warning: You are about to reset the table. \n\nDo you want to continue?",
cTitle: "Reset Table",
nIcon: 1, nType: 2
});
if (nButton == 4) {
put table reset code here
}
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies