Sep 20, 2013, 7:48 PM
[CLOSED] TreePanel - sorting behavior on drop
Hello! I'm working on a TreePanel interface and I'm not sure how to achieve a piece of functionality. I'm sure there's a way to do, but I haven't been able to find it in the docs.
Please consider this example:
Category 1
-- Category 2
-- Category 3
-- Leaf 1
But instead it looks like this:
Category 1
-- Category 2
-- Leaf 1
-- Category 3
I'm not sure whether I need to intercept the event and modify the index parameter before the drop or do some kind of reorder operation afterwards. If anyone could let me know how to achieve this functionality it would be a great help.
Thanks!
Please consider this example:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Ext.NET 2.2 Example</title>
<ext:ResourcePlaceHolder runat="server" ID="ResourcePlaceHolder1" />
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager runat="server" />
<%-- Viewport --%>
<ext:Viewport runat="server" ID="ViewportMain" StyleSpec="background-color: #DFE8F6" Layout="FitLayout">
<Items>
<ext:TreePanel runat="server" ID="ServiceNodeTreePanel" ClientIDMode="Static" RootVisible="false" SingleExpand="true">
<Model>
<ext:Model runat="server" ID="ServiceNodeModel">
<Fields>
<ext:ModelField Name="Title" Type="String" />
</Fields>
</ext:Model>
</Model>
<ColumnModel>
<Defaults>
<ext:Parameter Name="Sortable" Value="false" />
</Defaults>
<Columns>
<ext:TreeColumn ID="TreeColumn1" runat="server" Text="Title" DataIndex="Title" Flex="1" />
</Columns>
</ColumnModel>
<Root>
<ext:Node NodeID="0" Text="Root">
<Children>
<ext:Node Expanded="true">
<CustomAttributes>
<ext:ConfigItem Name="Title" Value="Category 1" />
</CustomAttributes>
<Children>
<ext:Node EmptyChildren="true">
<CustomAttributes>
<ext:ConfigItem Name="Title" Value="Category 2" />
</CustomAttributes>
</ext:Node>
<ext:Node Leaf="true">
<CustomAttributes>
<ext:ConfigItem Name="Title" Value="Leaf 1" />
</CustomAttributes>
</ext:Node>
</Children>
</ext:Node>
<ext:Node EmptyChildren="true">
<CustomAttributes>
<ext:ConfigItem Name="Title" Value="Category 3" />
</CustomAttributes>
</ext:Node>
</Children>
</ext:Node>
</Root>
<View>
<ext:TreeView runat="server">
<Plugins>
<ext:TreeViewDragDrop runat="server" />
</Plugins>
</ext:TreeView>
</View>
</ext:TreePanel>
</Items>
</ext:Viewport>
</form>
</body>
</html>
When I drag "Category 3" onto "Category 1", it is appended after the last child, which is a leaf. I would prefer to have it append after the last folder, but before the first leaf in the drop target's child node collection. That is, the tree should look like this:Category 1
-- Category 2
-- Category 3
-- Leaf 1
But instead it looks like this:
Category 1
-- Category 2
-- Leaf 1
-- Category 3
I'm not sure whether I need to intercept the event and modify the index parameter before the drop or do some kind of reorder operation afterwards. If anyone could let me know how to achieve this functionality it would be a great help.
Thanks!
Last edited by Daniil; Sep 24, 2013 at 3:42 AM.
Reason: [CLOSED]