Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Keith on Dec 11, 2008 14:52
open dhtmlx forum
Grid linked to tree locking up

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;



}
Answer posted by Support on Dec 12, 2008 02:24
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. 
Attachments (1)