- Mark as New
- Follow
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
Hi Praveen,
Your form is not shared so I have not been able to access it. But I have updated mine. There are now two approaches, one that follows on from the above method and updates each drop down list in each row. The second updates a separate dataset that the drop down list is bound to. This second approach requires the remerge() method which can cause problems if your code has updates some form properties like a borders color as these will be reset, but the code is simplier and you will only have one list to maintain. The add button click code is;
var particulars = xfa.datasets.resolveNode("particulars");
if (particulars === null)
{
particulars = xfa.datasets.createNode("dataGroup","particulars");
xfa.datasets.nodes.append(particulars);
}
var particular = xfa.datasets.createNode("dataValue","particular");
particular.value = ItemName.rawValue;
var boundValue = xfa.datasets.createNode("dataValue","id");
boundValue.value = BoundValue.rawValue;
particular.nodes.append(boundValue);
boundValue.contains = "metaData";
// find sorted position to insert
for (var i = 0; i < particulars.nodes.length; i++)
{
p = particulars.nodes.item(i);
if (p.value > particular.value)
{
particulars.nodes.insert(particular, p);
break;
}
}
// add to end if greater than all existing items
if (particular.parent === null)
{
particulars.nodes.append(particular);
}
// clear source fields
ItemName.rawValue = null;
BoundValue.rawValue = null;
// remerge form data to pick up new item
xfa.form.remerge();
And the binding looks like;
I have updated my sample to include both methods, https://workspaces.acrobat.com/?d=OwysfJa-Q3HhPtFlgRb62g
Regards
Bruce
Views
Replies
Total Likes