Hi all,
I’m using the DhtmlxSuite v 2.6.
While dragging a grid row into a tree branch in Firefox 3.6.12, the firebug raised the following problem : “itemObject.parentObject is undefined”.
The debugger stops at row #2000 of “/dhtmlxTree/sources/dhtmlxtree.js” file in sources folder.
The functions call stack is:
_moveNodeTo()
_moveNode()
_drag()
stopDrag()
Here’s my code:
<html>
<head>
<title>Doesn't matter</title>
<script src="<?=BASE_URL?>/js/jquery.1.4.3.js"></script>
<script src="<?=BASE_URL?>/js/dhtmlx_auth/dhtmlxTree/codebase/dhtmlxcommon.js"></script>
<script src="<?=BASE_URL?>/js/dhtmlx_auth/dhtmlxGrid/codebase/dhtmlxgrid.js"></script>
<script src="<?=BASE_URL?>/js/dhtmlx_auth/dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>
<script src="<?=BASE_URL?>/js/dhtmlx_auth/dhtmlxGrid/codebase/ext/dhtmlxgrid_drag.js"></script>
<script src="<?=BASE_URL?>/js/dhtmlx_auth/dhtmlxTree/sources/dhtmlxtree.js"></script>
<script src="<?=BASE_URL?>/js/dhtmlx_auth/dhtmlxTree/codebase/ext/dhtmlxtree_ed.js"></script>
</head>
<body>
<div id="categs"></div>
<div id="gridbox" style="width:40%;height:470px;background-color:white;"></div>
</body>
<script>
var mygrid,tree;
$(document).ready(function(){
mygrid = new dhtmlXGridObject('gridbox');
tree = new dhtmlXTreeObject("categs", "100%", "100%", 0);
setTimeout(buildTree, 10);
setTimeout(buildGrid, 11);
//dnd_copyA (true);
});
function buildTree() {
tree.setImagePath("<?=BASE_URL?>/js/dhtmlx_auth/dhtmlxTree/codebase/imgs/csh_bluebooks/");
tree.enableDragAndDrop(true);
tree.setSkin("dhx_skyblue");
tree.loadXML("<?=BASE_URL?>/ws_categories_tree.php");
tree.enableItemEditor(true);
tree.setOnClickHandler(getMetaData);
tree.attachEvent('onDrop',function(source_id,target_id,bef_id,source_object,target_object){
alert (source_object);
});
}
function buildGrid() {
//set grid parameters;
mygrid.selMultiRows = true;
mygrid.setImagePath("<?=BASE_URL?>/js/dhtmlx/dhtmlxGrid/codebase/imgs/");
mygrid.setHeader("#,Precodice,Codice,Descrizione");
mygrid.setInitWidths("50,40,120,120");
mygrid.setColAlign("right,left,left,right");
mygrid.setColTypes("ed,ed,ed,ed");
mygrid.setColSorting("int,str,str,int");
mygrid.setMultiLine(true);
mygrid.enableDragAndDrop(true);
//start grid;
mygrid.init();
mygrid.setSkin("dhx_skyblue");
mygrid.loadXML("<?=BASE_URL?>/ws_articles.php");
//redefine tree-to-grid drop element;
mygrid.treeToGridElement = function(treeObj, treeNodeId, gridRowId) {
return [0, treeObj.getItemText(treeNodeId)];
}
//redefine grid-to-tree drop element;
mygrid.gridToTreeElement = function(treeObj, treeNodeId, gridRowId) {
return this.cells(gridRowId, 1).getValue() + "/" + this.cells(gridRowId, 2).getValue();
}
mygrid.rowToDragElement = function(id) {
if (this.cells(id, 2).getValue() != "");
return this.cells(id, 2).getValue() + "/" + this.cells(id, 1).getValue();
return this.cells(id, 1).getValue();
}
}
function getMetaData(id) {
if (tree.getUserData(id, "c0")) {
alert("Sales dynamic is: " + tree.getUserData(id, "c0") + "\nPrice is: " + (tree.getUserData(id, "c3") || "na"));
}
}
function dnd_copyA(mode) {
mygrid.enableMercyDrag(mode);
tree.enableMercyDrag(mode);
}
</script>
</html>
Please help me i’m new to this powerful tool !!
Thanks!