Hello,
I have code written that displays a tree grid. The tree may have several levels all of which have check boxes in the first column. The code below causes all the child nodes under a parent to be (un)checked when the parent node is (un)checked.
Is it possible to detect a ctrl + click so that I can avoid (un)checking all child nodes? It seems that the API does not allow me to detect this with the given parameters.
Thanks,
Mike
[code]orgunitonlygrid = new dhtmlXGridObject(‘orgunitonlybox’);
orgunitonlygrid.imgURL = contextPath+"/include/dhtmlx/codebase/imgs/icons_greenfolders/";
orgunitonlygrid.setHeader(“Select,Org Unit Name”);
orgunitonlygrid.attachHeader(" ,#text_search");
orgunitonlygrid.setInitWidths(“50,*”);
orgunitonlygrid.setColAlign(“center,left”);
orgunitonlygrid.setColTypes(“ch,tree”);
orgunitonlygrid.enableTreeCellEdit(false);
orgunitonlygrid.setFiltrationLevel(-2);
orgunitonlygrid.setSkin(“dhx_skyblue”);
orgunitonlygrid.attachEvent(“onCheck”, doOrgUnitOnlyCheck);
orgunitonlygrid.attachEvent(“onFilterStart”, function(indexes,values){
expandAll = false;
for (i = 0; i < values.length; i++) {
if (values[i] != “”) {
expandAll = true;
break;
}
}
return true;
});
orgunitonlygrid.attachEvent("onFilterEnd", function(elements){
if (expandAll) {
orgunitonlygrid.expandAll(true);
}
});
orgunitonlygrid.init();
orgunitonlygrid.load("/config/orgtree/orgonlytree.xml", doOrgUnitOnlyLoad);
function doOrgUnitOnlyCheck(rId,cInd,state) {
// open process dialog
var html = "<img src='" + contextPath + "/images/indicator.gif'/> selecting...please wait.";
document.getElementById("processdialog").innerHTML = html;
$('#processdialog').dialog('open');
// create a time delay for the dialog to popup
window.setTimeout('selectOrgUnitOnly(\''+rId+'\','+state+')',200);
}
function selectOrgUnitOnly(rId,state) {
var allsubs = orgunitonlygrid.getAllSubItems(rId);
if (allsubs != "") {
var subs = allsubs.split(",");
for (var i = 0; i < subs.length; i++) {
orgunitonlygrid.openItem(subs[i]);
orgunitonlygrid.cells(subs[i], 0).setValue(state);
}
}
//Parse org units, remove learner IDs.
var checkRows = orgunitonlygrid.getCheckedRows(0).split(",");
var newValue = "";
for (var i = 0; i < checkRows.length; i++){
newValue += checkRows[i].split("_")[0] + ",";
}
//Remove ending comma if it exists.
if (newValue.length > 1)
newValue = newValue.substring(0,newValue.length-1);
document.getElementById("orgUnitOnlyIds").value = newValue;
$('#processdialog').dialog('close');
}
[/code]