PDA

View Full Version : [CLOSED] [#315] Exception is thrown when expanding a tree node after inserting a column into TreePanel



RCN
Aug 05, 2013, 1:53 PM
Few days ago i opened a thread regarding the best way to add a column into a TreePanel: http://forums.ext.net/showthread.php?25801-CLOSED-which-is-the-best-way-to-add-a-column-into-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.

http://forums.ext.net/attachment.php?attachmentid=6687&stc=1

An exception is thrown at ItemAdd method

http://forums.ext.net/attachment.php?attachmentid=6688&stc=1

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>


Controller


using 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?

Daniil
Aug 05, 2013, 2:40 PM
Hi Raphael,

Please take the note of the bottom of this post into consideration.
http://forums.ext.net/showthread.php?25801&p=114073&viewfull=1#post114073



As for a CommandColumn in a TreePanel, please do not forget that it works with OverOnly="true" only.
https://github.com/extnet/Ext.NET/issues/58

Does it not work with overOnly: true?

Daniil
Aug 05, 2013, 5:03 PM
I am wrong. A CommandColumn without OverOnly="true" should work in a TreePanel. So, we are investigating.

RCN
Aug 05, 2013, 5:18 PM
Thank you Daniil. Please keep me posted.

Daniil
Aug 06, 2013, 3:54 AM
There is a bug in ExtJS. A TreeView doesn't pass nodes into its itemadd listener. Reported to Sencha.
https://github.com/extnet/Ext.NET/issues/315

It has been fixed for CommandColumn and ComponentColumn in SVN trunk.

Thank you for the report!

RCN
Aug 06, 2013, 11:45 AM
Thank you Daniil. I will retest.

RCN
Aug 06, 2013, 12:23 PM
Once again, thank you Daniil. Please mark this thread as closed.

RCN
Jan 29, 2015, 4:01 PM
I think that this thread should be closed but it's still open.

I was not able to test whether it's resolved on version 3.1.0 because there is an issue related to inserting a command column into grid http://forums.ext.net/showthread.php?52381-Insert-command-column-into-grid.

I will review this thread when issue related to inserting a command column into grid is resolved.

Daniil
Jan 30, 2015, 6:37 AM
Thanks for the review!


I think that this thread should be closed but it's still open.

It was left open, because it was fixed in Ext.NET for CommandColumn and ComponentColumn only, but the original ExtJS bug was not fixed. Now I retested with pure ExtJS 5.1.0 and the issue is fixed. So, marking closed.


I was not able to test whether it's resolved on version 3.1.0 because there is an issue related to inserting a command column into grid http://forums.ext.net/showthread.php?52381-Insert-command-column-into-grid

This issue has been fixed as well.

RCN
Jan 30, 2015, 11:46 AM
I confirm that it has been fixed.