I have attached a screenshot.
Here is the code:
[code]var geoPlacesGrid = ui.accordion.obj.cells(“places_binding”).attachGrid();
geoPlacesGrid.setSkin(defSkin);
geoPlacesGrid.setImagePath(gridImagePath);
geoPlacesGrid.setHeader(“Обект,Тип,”);
geoPlacesGrid.setInitWidths(“*,200,30”);
geoPlacesGrid.setColAlign(“left,left,center”);
geoPlacesGrid.setColTypes(“tree,ro,ch”);
geoPlacesGrid.setColSorting(“na,na,na”);
geoPlacesGrid.setStyle(“”,“border-width:1px 0px 1px 0px;font-size:11px;color:#46484D”,“”,“”);
geoPlacesGrid.init();
geoPlacesGrid.loadXML(“…/…/…/MarkedPlacesServlet?type=LOAD_MARKED_PLACES_GRID&client_id=” + selectedParentClient.client_id);
geoPlacesGrid.attachEvent(“onXLE”, function(){
});
geoPlacesGrid.attachEvent("onCheck", function(rId,cInd,state){
onCheckFunction(rId, cInd, state);
});
geoPlacesGrid.attachEvent("onRowSelect", function(rId, cInd){
if(cInd === 2) {
if(geoPlacesGrid.getCellExcellType(rId, cInd) === "img") {
geoPlacesGrid.setCellExcellType(rId, cInd,"ch");
geoPlacesGrid.cells(rId, cInd).setValue(1);
onCheckFunction(rId, cInd, true);
}
}
geoPlacesGrid.clearSelection();
if(geoPlacesGrid.getOpenState(rId) === false){ geoPlacesGrid.openItem(rId); }
else geoPlacesGrid.closeItem(rId);
});
var onCheckFunction = function(rId, cInd, state) {
var listOfChikdIds = [];
walkTreeGridChildItems(geoPlacesGrid, rId, listOfChikdIds);
for(var i=0; i<listOfChikdIds.length; i++) {
var nextId = listOfChikdIds[i];
if(geoPlacesGrid.getCellExcellType(nextId, cInd) === "img") {
geoPlacesGrid.setCellExcellType(nextId, cInd, "ch");
}
geoPlacesGrid.cells(nextId, cInd).setValue(state);
}
var listOfParentIds = [];
var parentId = geoPlacesGrid.getParentId(rId);
while(parentId !== 0) {
listOfParentIds.push(parentId);
parentId = geoPlacesGrid.getParentId(parentId);
}
for(var i=0; i<listOfParentIds.length; i++) {
var nextParentId = listOfParentIds[i];
//alert(nextParentId);
var childIds = geoPlacesGrid.getSubItems(nextParentId);
var splitArr = childIds.split(",");
var allChecked = true;
var allUncked = true;
for(var j=0; j<splitArr.length; j++) {
var nextChildId = splitArr[j];
if(geoPlacesGrid.getCellExcellType(nextChildId,cInd) === "img") {
allChecked = false;
allUncked = false;
break;
}
else {
var checkState = geoPlacesGrid.cells(nextChildId, cInd).getValue();
if(checkState === "1") {allUncked = false;}
else if(checkState === "0") {allChecked = false;}
}
}
if(allChecked) {
geoPlacesGrid.setCellExcellType(nextParentId, cInd, "ch");
geoPlacesGrid.cells(nextParentId, cInd).setValue(1);
}
if(allUncked) {
geoPlacesGrid.setCellExcellType(nextParentId, cInd, "ch");
geoPlacesGrid.cells(nextParentId, cInd).setValue(0);
}
if(allChecked === false && allUncked === false)
{
geoPlacesGrid.setCellExcellType(nextParentId, cInd, "img");
geoPlacesGrid.cells(nextParentId, cInd).setValue(gridImagePath + "/dhxtree_web/iconCheckGray.gif");
}
}
}; [/code]