Aug 05, 2013, 1:53 PM
[CLOSED] [#315] Exception is thrown when expanding a tree node after inserting a column into TreePanel
Few days ago i opened a thread regarding the best way to add a column into a TreePanel: http://forums.ext.net/showthread.php...to-a-TreePanel. The approach given by the thread works as expected, but at this time, i am facing an issue when expanding an item, after adding a column into the TreePanel.
On the example below, press Insert Column button, then expand any item of the TreePanel.
An exception is thrown at ItemAdd method
View
Any ideas to overcome this issue?
On the example below, press Insert Column button, then expand any item of the TreePanel.
An exception is thrown at ItemAdd method
View
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<script type="text/javascript">
var insertColumn = function () {
App.TreePanel1.insertColumn(1, Ext.create('Ext.grid.column.CommandColumn', {
xtype: "commandcolumn",
text: '',
width: 23,
sortable: false,
hideable: false,
resizable: false,
draggable: false,
commands: [{
xtype: "button",
command: "Command",
iconCls: "#BulletCross",
tooltip: {
text: ""
}
}]
}), true);
}
</script>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:Button Text="Insert Column" runat="server">
<Listeners>
<Click Handler="insertColumn();" />
</Listeners>
</ext:Button>
<%--Tree Panel--%>
<ext:TreePanel ID="TreePanel1" RootVisible="false" Title="Ext.Net" Height="700" Width="500"
Margins="10" Border="false" runat="server">
<Store>
<ext:TreeStore runat="server">
<Proxy>
<ext:AjaxProxy Url="/Example/LoadTreeFakeChildren">
<ActionMethods Read="POST" />
<Reader>
<ext:JsonReader Root="data" />
</Reader>
</ext:AjaxProxy>
</Proxy>
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="Task" />
<ext:ModelField Name="Column1" />
</Fields>
</ext:Model>
</Model>
</ext:TreeStore>
</Store>
<Root>
<ext:Node NodeID="0" Text="Root" />
</Root>
<ColumnModel>
<Columns>
<ext:TreeColumn Text="Task" Lockable="true" DataIndex="Task" Flex="2" runat="server" />
<ext:Column Text="Column1" Lockable="true" DataIndex="Column1" runat="server" />
</Columns>
</ColumnModel>
</ext:TreePanel>
</body>
</html>
Controllerusing System;
using System.Web.Mvc;
using Ext.Net;
using Ext.Net.MVC;
namespace SandBox.Controllers
{
public class ExampleController : System.Web.Mvc.Controller
{
public ActionResult Index()
{
return View();
}
public StoreResult LoadTreeFakeChildren()
{
NodeCollection nodes = new NodeCollection(false);
for (int index = 1; index < 6; index++)
{
Node no = new Node();
no.NodeID = index.ToString() + DateTime.Now.Second;
no.CustomAttributes.Add(new ConfigItem { Name = "Task", Value = no.NodeID, Mode = ParameterMode.Value });
no.CustomAttributes.Add(new ConfigItem { Name = "Column1", Value = Guid.NewGuid().ToString(), Mode = ParameterMode.Value });
nodes.Add(no);
}
return new StoreResult { Data = nodes.ToJson() };
}
}
}
Any ideas to overcome this issue?
Last edited by RCN; Feb 13, 2015 at 4:00 PM.