Hi , guys
I'm using Adobe LiveCycle 10.4.0 ES2.0. I get confusing about using removeInstance(). I want to delete the row items based on parameter from data structure. And my codes seems noneffective. My codes in table layout:ready* is :
var valFs;
var numrows = xfa.resolveNodes("SRFS_PL_FINSTMNT_XSD_REP_DATA.bdyMain.tblLineItems.rowLineItem[*]").length;
for (var x=0; x < numrows; x++)
{
valFs = xfa.resolveNode("$record.LISTFINSTMNT.item[" + x + "].FSTYPE").value;
if (valFs == "AA")
{
SRFS_PL_FINSTMNT_XSD_REP_DATA.bdyMain.tblLineItems.rowLineItem.instanceManager.removeInstance(x);
}
}
Actually, the result really delete some items, but it seems delete row items randomly. Can you please answer how to use removeInstance() if I want to delete row items depend on another parameter in table? Thanks.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi, you should go though your table backwards, so "for (var x=numrows -1; x >= 0; x--)" as deleting rows will change the number of rows but you have already calculated numrows.
Also, you should not do this in the layout:ready event as it will cause the event to fire again, see this reference https://helpx.adobe.com/pdf/aem-forms/6-3/scripting-basics.pdf#nameddest=G6.1668520
Hi, you should go though your table backwards, so "for (var x=numrows -1; x >= 0; x--)" as deleting rows will change the number of rows but you have already calculated numrows.
Also, you should not do this in the layout:ready event as it will cause the event to fire again, see this reference https://helpx.adobe.com/pdf/aem-forms/6-3/scripting-basics.pdf#nameddest=G6.1668520
Hi BR001,
Thanks, it really works.
BR, PiPi Li
Views
Replies
Total Likes
Views
Likes
Replies