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

  1. #1

    [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
    <!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?
    Attached Thumbnails Click image for larger version. 

Name:	001.jpg 
Views:	21 
Size:	49.0 KB 
ID:	6687   Click image for larger version. 

Name:	002.png 
Views:	15 
Size:	77.5 KB 
ID:	6688  
    Last edited by RCN; Feb 13, 2015 at 4:00 PM.
  2. #2
    Hi Raphael,

    Please take the note of the bottom of this post into consideration.
    http://forums.ext.net/showthread.php...l=1#post114073

    Quote Originally Posted by Daniil View Post
    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?
  3. #3
    I am wrong. A CommandColumn without OverOnly="true" should work in a TreePanel. So, we are investigating.
  4. #4
    Thank you Daniil. Please keep me posted.
  5. #5
    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!
  6. #6
    Thank you Daniil. I will retest.
  7. #7
    Once again, thank you Daniil. Please mark this thread as closed.
  8. #8
    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...lumn-into-grid.

    I will review this thread when issue related to inserting a command column into grid is resolved.
  9. #9
    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...lumn-into-grid
    This issue has been fixed as well.
  10. #10
    I confirm that it has been fixed.

Similar Threads

  1. Replies: 13
    Last Post: Aug 06, 2013, 3:58 AM
  2. Replies: 10
    Last Post: May 31, 2013, 12:54 PM
  3. Replies: 1
    Last Post: Nov 01, 2012, 5:16 PM
  4. [CLOSED] TreePanel refresh tree node
    By boris in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 16, 2011, 10:32 AM
  5. TreePanel,tree node Font size
    By kiran malgi in forum 1.x Help
    Replies: 0
    Last Post: May 17, 2010, 7:28 AM

Posting Permissions