PDA

View Full Version : [CLOSED] TreePanel BeforeNodeDrop Event



sailendra
Apr 04, 2012, 8:13 AM
I need to check the node drop condition so that only when the condition is matched, drop event will be triggerd otherwise return false to cancel the drop. I'am using the latest version of Ext.net dll file, Is BeforeNodeDrop property is missing on this version or any other similar property if available to achieve this ?


Thanks



Which property can be used on the following scenario?


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestTree.aspx.cs" Inherits="Web.Report.TestTree" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<%@ Import Namespace="System.Collections.Generic" %>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
this.BuildTree(TreePanel1.Root);
}
}

private Ext.Net.NodeCollection BuildTree(Ext.Net.NodeCollection nodes)
{
if (nodes == null)
{
nodes = new Ext.Net.NodeCollection();
}

Ext.Net.Node root = new Ext.Net.Node();
root.Text = "Root";
nodes.Add(root);

string prefix = DateTime.Now.Second + "_";

for (int i = 0; i < 5; i++)
{
Ext.Net.Node node = new Ext.Net.Node();
Ext.Net.Node node1 = new Ext.Net.Node();
node1.Text = "Test";
node1.Leaf = true;
node.NodeID = i.ToString();
node.Text = prefix + i;
node.Children.Add(node1);
root.Children.Add(node);
}

return nodes;
}
</script>

<!DOCTYPE html>

<html>
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="Form1" runat="server">
<c:ContentHeader ID="ContentHeader_one" runat="server" />
<ext:TreePanel
ID="TreePanel1"
runat="server"
Title="Account List"
Icon="ApplicationEdit"
AutoScroll="true"
ContainerScroll="true"
RootVisible="false"
Height="500"
EnableDD="true"
Mode="Local"
Width="500"
RemoteJson="false">

<View>
<ext:TreeView ID="TreeView1" runat="server">
<Plugins>
<ext:TreeViewDragDrop ID="TreeViewDragDrop1" runat="server" AppendOnly="true">
</ext:TreeViewDragDrop>
</Plugins>
</ext:TreeView>
</View>

</ext:TreePanel>
</form>
</body>
</html>

Vladimir
Apr 04, 2012, 9:21 AM
Hi,

Please use BeforeDrop event of TreeView
That event uses the following arguments
(node,data,overModel,dropPosition,dropFunction)

target nodes - data.records
destination node - overModel