Rank: Member Groups: Member
Joined: 2/25/2008 Posts: 14
|
Hi,
I have a treeview with nodes that the user should be able to reorder (drag&drop) and to click to see the node details.
I need that the onnode click event raises a server side event, to load the associated data, but I don't need any server side event when the user drag&drop the nodes.
What I'm getting is an itemclick event on server side after the drag&drop operation ends. Is this the treeviews spected behaviour? Is there a way to make some events serverside and others client side only?
Right now I'm trying to make it work using javascript, but maybe there is a better solution to this problem.
Thanks in advance for your help,
Luis
|
Rank: Member Groups: Member
Joined: 2/25/2008 Posts: 14
|
Hi, I've been able to solve it. I don't know if this is the "intended" way to do it, but it works 8·) What I've done is.
Code: JavaScript
var nodeDragged = false;
//Handles the ItemClick event on client
//If this event fires after a node drop, I cancel it.
function ItemClick(e, eventInfo) {
if (!nodeDragged) {
nodeDragged = false;
return true;
}
else nodeDragged = false;
return false;
}
function ItemDrop(treeview, srcNode, destNode, newIndex) {
nodeDragged = true;
}
//When a node is draggin I will cancel the click event
function CheckDrop(treeview, srcNode, destNode, newIndex) {
nodeDragged = true;
...more internal code follows
}
And, in server side, this is what I've written:
Code: C#
myTreeView.RaisesServerEvent = true;
myTreeView.AllowDragReordering = true;
myTreeView.ClientSideOnDragOver = "CheckDrop";
myTreeView.ClientSideOnItemClick = "ItemClick";
Hope this helps 8·), luis
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Cool. Thanks for sharing!
|