Hi,
I was just wondering if it was possible to add or delete a table row without adding a button to the table row? For example, I was planning to put some code in the form:ready event where is a certain row is null, then I would just remove it from the table.
Any help would be appreciated.
Thanks,
Vinsanity
////////////////////////////////////////////////////////////////////////////////////////////////
// This function toggles the availability of tables passed to it.
// If the table is to be disabled it deletes the rows in a table that is passed in to it, keeping
// one last row, but disabling it and the add_row button. Otherwise it will enable the fields
// and the add_row button.
function toggleTable (tableName, setting) {
var buttonColor // Color of buttons for Add Row.
var redBox // Determines whether or not fields are mandatry, and thus display a red box.
// Set some preliminary variables buttonColor and redBox
if (setting == "open") { // Enable fields, make some mandatory, and set button color to gray
buttonColor = "212,208,200";
}
else { // Disable fields and set button colors to white.
buttonColor = "255,255,255";
}
// If the second row isn't empty, remove it. Keep doing it until you have one row left.
if (setting == "readOnly"){
while (xfa.resolveNode(tableName + ".ROW[1]") != null){
xfa.resolveNode(tableName).ROW.instanceManager.removeInstance(0);
} // End While
} // Endif
// Delete or enable the contents of the rows.
var oNodes = xfa.resolveNode(tableName).ROW.nodes;
var nodesLength = oNodes.length;
for (var i = 0; i < nodesLength; i++) {
if (setting == "readOnly"){ // if disabling table, delete contents of last row
oNodes.item(i).rawValue = null;
} // Endif
oNodes.item(i).access = setting;
} // End for
// Set Add_Row color and availability
xfa.resolveNode(tableName).parent.ADD_ROW.fillColor = buttonColor;
xfa.resolveNode(tableName).parent.ADD_ROW.access = setting;
} // End clearTable function.