Expand my Community achievements bar.

SOLVED

Clear all data from table row

Avatar

Level 9

Is there a short script to make all the fields in the same table row null (blank)? I want to clear all data when that row is deleted.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

This JavaScript function will reset all the fields within the row passed in;

function clear(row)

{

    var resetList = [];

    var fields = row.resolveNodes("#field[*]");

    for (var i = 0; i < fields.length; i++)

    {

        resetList.push(fields.item(i).somExpression);

    }

    xfa.host.resetData(resetList.join(","));

}

 

So to remove all the data from the second row you could call it using;

 

clear(xfa.resolveNode("Table1.Row[1]"));

 

Hope that helps

Bruce

View solution in original post

4 Replies

Avatar

Level 10

Hi,

I don't understand the problem, if you delete the row then the fields within that row are deleted as well.

What sort of binding are you using.

Regards

Bruce

Avatar

Level 9

Sorry - what I should have said was I want to hide the bottom row when the user clicks the delete button. This will also remove al the data that the user enetered into that row.

Avatar

Correct answer by
Level 10

Hi,

This JavaScript function will reset all the fields within the row passed in;

function clear(row)

{

    var resetList = [];

    var fields = row.resolveNodes("#field[*]");

    for (var i = 0; i < fields.length; i++)

    {

        resetList.push(fields.item(i).somExpression);

    }

    xfa.host.resetData(resetList.join(","));

}

 

So to remove all the data from the second row you could call it using;

 

clear(xfa.resolveNode("Table1.Row[1]"));

 

Hope that helps

Bruce