3.2.0

Disable a Checkbox

I have a Checkbox in my grid that displays the value from a Recordset.

I want to diable this button so the user can not change it from the grid, but instead double click on the the row to open up a new page that displays more data for the record that is needing to be changed.

My question is how do I disable the checkbox in the grid after i have populated it?

CODE:

// create grid control & checkbox
var obj = new AW.UI.Grid;
obj.setId("myGrid");
obj.setSelectorVisible(true);
obj.setSelectionMode("single-row");
obj.setVirtualMode(true);
obj.setCellText(myCells);
obj.setHeaderText(myHeaders);

function image(col, row){
if (this.getCellText(2, row) == "0") {
return false;
}
else {
return true;
}
}

obj.setCellTemplate(new AW.Templates.Checkbox, 2);
obj.setCellValue(image, 2);


// Disables the text
// obj.setAttribute('disabled', true);



// set number of columns/rows
obj.setColumnCount(myHeaders.length);
obj.setRowCount(myCells.length);
obj.setColumnWidth(0, 0);
obj.setFixedLeft(1);
obj.onRowDoubleClicked = function(event, index){ window.location = "containers_edit.asp?SPILL_ID=" + obj.getCellValue(0,index) + "&zone_name=<%=request.querystring("zone_name")%>&template_type=<%=request.querystring("template_type")%>&rowid=" + index};

// write grid to the page
<%if request.querystring("rowid") <> "" then%>
var therow = <%=request.querystring("rowid")%>
obj.setSelectedRows([therow]);
obj.setCurrentRow(therow);

<%end if%>

document.write(obj);
Christy
December 22,
I have the same exact question....

I've tried workarounds like trying to not update anything on the cell changing value, on the cell edit ending, on cell edit ended, etc. etc.



no avail.

I've also done the myGrid.setCellEditable(false,myChkBoxColumn);

Alex, how is it supposed to be done?
John Mason
December 26,
Found it: overwrite the onclick functionality of the cell template... this way you can't check it at all!

myGrid.getCellTemplate(myChkBoxColumn).setEvent("onclick", function(){});
John Mason
December 26,
Solution:

not only do: myGrid.setCellEditable(false,myChkBoxColumn);

but also override the onclick for the celltemplate:

myGrid.getCellTemplate(myChkBoxColumn).setEvent("onclick", function(){});
John Mason
December 26,
Thanks John, That worked like a charm!!!! :)
Christy
December 28,

This topic is archived.

See also:


Back to support forum