I am trying to conditionally lock cells based on a value. This is something I have completed in the past, but cannot get to work in 11.1.2.1. Below is my code. I don't get any errors, so the cell object is identified. The properties of the object exist (I think) because setting cell.readonly=true does not cause an error. The redisplay seems to get called as well. However, nothing happens when the form is opened or changed. The function is in the ONLOAD function. I have verified that the looping is correct with alerts, so I know it is looping through the correct cells.
var r = 0;
var c2 = 0;
var c = currentDataGrid.startCol + 1; // account for a hidden column
var allocPct = 0;
valid = true;
// Loop through all rows except the last row, in the first column
for (c=currentDataGrid.startCol; c<=currentDataGrid.endCol; c++){
// Stop at the column where the account is ??????????????????
if(listContainsName(getColMembersOfCell(r, c), "HR_Post_Number")){
// Now that the account was found, look through each row
alert("HR_Post_Number found in column" + c);
for (r=currentDataGrid.startRow; r<=currentDataGrid.endRow - 1; r++){
// If the account has a value, make the entire row locked
if(!isNaN(getCellVal(r,c))){
alert("row " + r + getCellVal(r,c));
for (c2=currentDataGrid.startCol; c2<=currentDataGrid.endCol -1; c2++){
var cell = currentDataGrid.getCell(r,c2);
cell.readOnly = true;
redisplayCell(r,c2);
}
}
}
return; //exit as the column was found
}
}
If anybody can tell me why the cell.readonly=true and redisplay isn't doing anything (meaning the cell is still editable), I would appreciate it.
Edited by: user10920513 on Jul 18, 2012 1:19 PM