Well, I have worked out many of my issues, but for the life of me, I cant get this working.
Here is all of my code between 2 pages. The page that displays the grid and tree that I am working with (they have the needed data) and my some.php temp page that is inserting at this time for me .
Anyhow here is the details. It won’t work properly without an error. Once I get this working, it will be doing action update and not insert
treegrid.php page
Messages Prototype
<script src=“dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js”>
<script src=“dhtmlxTree/codebase/dhtmlxcommon.js”>
<script src=“dhtmlxTree/codebase/dhtmlxtree.js”>
<script src=“dhtmlxTree/codebase/ext/dhtmlxtree_xw.js”>
<script src=“dhtmlxGrid/codebase/dhtmlxgrid.js”>
<script src=“dhtmlxGrid/codebase/dhtmlxgridcell.js”>
<script src=“dhtmlxGrid/codebase/ext/dhtmlxgrid_drag.js”>
some.php
<?php
include(’…/dbconn.php’);
$markread=“insert into messagesreceived (folderid) VALUES ($_GET[folder])”;
mysql_query($markread) or die("Failed Query of " . $markread);
?>
Error type: LoadXML
Description: Incorrect XML
Press ok and get
Error type: DataStructure
Description: XML reffers to not existing parent
Thanks
James Mackinnon
You need to return correct XML structure even if it has no any practical usage in described case
some.php
<?php
include('../dbconn.php');
$markread="insert into messagesreceived (folderid) VALUES ($_GET[folder])";
mysql_query($markread) or die("Failed Query of " . $markread);
header ("content-type: text/xml");
?>
<?xml version="1.0" encoding="UTF-8" ?>
Got it figured out last night;)
I acutally did exactly what you mention.
However, I have one more issue
based on the same code listed above, I want the ability to drag and drop a folder in the tree into a sub folder but it does not seem to adjust when I do this.
I assume that I can setup a function as I have between the grid and the tree and then listen for tid or something in that function?
Also, is there a way to disable drag and drop in the root of the tree where it highlights yellow and also on the root of the tree as well?
Thanks again for your time on answering my foolish questions;)
James
Actually for all drag operations, which will ended in tree will be called the same onDrag event without difference is it grid-to-tree or tree-to-tree operation, you can use code similar to next, to separate different types of d-n-d
tree.attachEvent(“onDrag”,function(sid,tid,sobj,tobj){
if (sobj==tobj){
//drag and drop inside the same tree
… any code here …
return some;
}
if (sobj!=tobj){
//drag and drop from outside of tree
… any code here …
return some;
}
});
>>Also, is there a way to disable drag and drop in the root of the tree where it highlights yellow and also on the root of the tree as well?
To disable drag-n-drop on free space of tree you can use
tree.enableDragAndDrop(true,false); //second parameter control drop on free space.
Or in more common case it can be done by onDragIn event ( which occurs when item draged other potential target )
tree.attachEvent(“onDragIn”,function(sid,tid){
if (!tid) return false; //block free space
if (tid== some_root_id) return false; //block drop on item with some ID
return true; //allow any other variations
});
I have done this and it doesn’t move it, but it does delete it from the grid until I reclick on the folder to show that the items are still there
here is the code I have setup for the onDrag event. What can i do to have it not clear the grid if the item is not a valid move.
tree.attachEvent(“onDrag”,function(sid,tid){
if (!tid) return false;
if (tid == messages) return false;
return true;
mygrid.deleteRow(sid); //remove row from grid
James
Ok I figured this out however I have an issue i’m not sure about
I need to stop the ability to drag and drop items between 2 specific tree containers that have grids
Here is the code
function buildTree(){
tree.setImagePath("/images/tree/csh_bluebooks/");
tree.enableDragAndDrop(true);
tree.enableMultiselection(true);
tree.attachEvent(“onDrag”,function(sid,tid){
if (tid ==‘msgs’) return false;
if (tid == ‘0’) return false;
mygrid.deleteRow(sid); //remove row from grid
//tid - id of folder in tree
//sid - id of dragged item in grid
var url="…/…/modules/messages/some.php?folder="+tid+"&file="+sid;
tree.loadXML(url);
}
);
What I mean is as follows
I have 2 containers
Sent - ID of 398
Inbox - ID of 397
I don’t want the ability of dragging items from the inbox grid into the sent items grid and I don’t want the ability to drag any items out of the sent grid
I do however, need to drag and drop items from the inbox grid into other tree containers such as 399 which is not an issue
What code can I add into the onDrag function to stop the dragging and dropping into and out of the sent items folder as that should resolve my issues all around
Thanks
James
The onDrag handler process only “drop-in” operation, because you need to stop both operations, you can use next command to block all d-n-d operations in grid.
sentGrid.enableDragAndDrop(“temporary_disabled”);
this command can’t be issued at any time and block any d-n-d actions in or out of component.
Later, if necessary you can re-enable d-n-d by
sentGrid.enableDragAndDrop(true);
So when you loading in grid “send” content - first command need to be executed, if any other content - second one.