I set up one column as a tree in my grid. It works fine the first time but if I reload the grid the nodes still open up but double clicking on an item does nothing. I have tried several variations of code. The only way I have got it to work is if I don’t initialze the grid each time but just do a loadXmlString(). The issue with that is I’m using splitAt so when I refresh I get extra rows of column headers each time I refresh. I include the column info on the load so the grid is reset in the origional order to lload the row data and then I use the loadOrderFromCookie().
---------------------
function loadGrid(treeString, gridString) {
if (!treeLoaded) {
tree = new dhtmlXTreeObject(treebox, “100%”, “100%”, 0);
tree.setImagePath(“dhtmlx/dhtmlxTree/codebase/imgs/”);
tree.loadXMLString(treeString, function() {
mygrid = new dhtmlXGridObject(‘masterlist’);
mygrid.setImagePath(“dhtmlx/dhtmlxGrid/codebase/imgs/”);
mygrid.setSkin(“gray”);
mygrid.enableSmartRendering(true, 50);
mygrid.enableEditEvents(true, true, true);
mygrid.attachEvent(“onMouseOver”, doOnRowSelect);
mygrid.attachEvent(“onEditCell”, doCellChanged);
mygrid.attachEvent(“onRightClick”, distributeSelected);
mygrid.setDateFormat(“m-d-y”);
mygrid.enableColumnMove(true);
mygrid.enableSortingSaving();
mygrid.enableOrderSaving();
mygrid.enableAutoSizeSaving();
mygrid.attachEvent(“onAfterCMove”, function(a, b) {
colId = mygrid.getColIndexById(“Security_Cd”);
mygrid.setSubTree(tree, colId, 0);
return true;
});
mygrid.setSubTree(tree, 4, 0);
mygrid.init();
mygrid.splitAt(2);
});
}
else {
mygrid = new dhtmlXGridObject(‘masterlist’);
mygrid.setImagePath(“dhtmlx/dhtmlxGrid/codebase/imgs/”);
mygrid.setSkin(“gray”);
mygrid.enableSmartRendering(true, 50);
mygrid.enableEditEvents(true, true, true);
mygrid.attachEvent(“onMouseOver”, doOnRowSelect);
mygrid.attachEvent(“onEditCell”, doCellChanged);
mygrid.attachEvent(“onRightClick”, distributeSelected);
mygrid.setDateFormat(“m-d-y”);
mygrid.enableColumnMove(true);
mygrid.enableSortingSaving();
mygrid.enableOrderSaving();
mygrid.enableAutoSizeSaving();
mygrid.attachEvent(“onAfterCMove”, function(a, b) {
colId = mygrid.getColIndexById(“Security_Cd”);
mygrid.setSubTree(tree, colId, 0);
return true;
});
mygrid.setSubTree(tree, 4, 0);
mygrid.init();
mygrid.splitAt(2);
}
//after else
mygrid.loadXMLString(gridString, function() {
mygrid.loadOrderFromCookie();
//mygrid.loadSortingFromCookie();
mygrid.loadSizeFromCookie();
});
mygrid.setColSorting(“str,str,str,str,str,str,str,str,str,str,str,na,str,date,date,str,date,str,str”);
dataChanged = false;
}
Problem confirmed - please try to use attached js file instead of original one.
>>'m using splitAt so when I refresh I get extra rows of column headers each time I refresh
If you will load only data part of grid ( without head section ) - grid will be correctly loaded even in splitAt mode. If head section exists , it results in full re-configuration, which produce not necessary header lines.
dhtmlxgrid_excell_tree.zip (803 Bytes)