Hi Angel,
As a follow up, is there a way to change a column's readonly status with client-side javascript? In this case, the user selects from two choices in a dropdown list. Based upon the selection, I need to modify the content of a field (I update the innerText). I can update the innerText, but if I click on the field, I get an error saying "Object doesn't support property or method 'getElementsByTagName'". Looking at the call stack, it appears to fail while attempting to invoke _openEditFromEvent. I suspect this is because the field is editable. Perhaps, if I set the column to read-only, the edit event would not be generated. I want to do this on the client since the user must be able to seamlessly switch their selection to restore the original value and allow editing of the column.
If I execute the following code, it replaces the innerText as expected. However, if I select any of the updated fields I get the error. If I don't change the innerText, I can click on the cells without getting the error (but the value is not correct).
// ... get the 'editable' Local Currency price cells and ...
var regAvgPriceLCCell = dataItem.get_cell("REG_PRICE_LC");
var dirAvgPriceLCCell = dataItem.get_cell("DIR_PRICE_LC");
var yoiAvgPriceLCCell = dataItem.get_cell("YOI_AVG_PRICE_LC");
var y1AvgPriceLCCell = dataItem.get_cell("Y1_AVG_PRICE_LC");
//... and if we are asked to display dollar values ...
if (document.getElementById("<%=hiddenUseLocalCurrency.ClientID%>").value == "false") {
regAvgPriceLCCell.innerText = dataItem.get_cell("REG_PRICE_DOLLARS").innerText.replace("$", "");
dirAvgPriceLCCell.innerText = dataItem.get_cell("DIR_PRICE_DOLLARS").innerText.replace("$", "");
yoiAvgPriceLCCell.innerText = dataItem.get_cell("YOI_AVG_PRICE_DOLLARS").innerText.replace("$", "");
y1AvgPriceLCCell.innerText = dataItem.get_cell("Y1_AVG_PRICE_DOLLARS").innerText.replace("$", "");
}
So, is it possible to change the column to readonly, and back again, using javascript?
Thank you